/seo-audit-skills:cache-headersfrom seo-audit-skills
Guides on cache architecture for SEO: Cache-Control directives, CDN vs browser cache, ETag/Last-Modified validation, and CMS caching setups (WP Rocket, LiteSpeed, PrestaShop, Nginx/Apache). Use for TTFB issues, caching layer audits, or configuring cache headers.
Ships in seo-audit-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Correct caching is the single highest-ROI performance optimization for most sites. A cold origin TTFB of 800ms becomes < 50ms with a CDN cache hit.
| Directive | Meaning | Use case |
|---|---|---|
max-age=N | Browser can cache for N seconds | Static assets |
s-maxage=N | CDN/shared cache can cache for N seconds | CDN-specific TTL |
no-cache | Must revalidate with server before using cache | HTML pages |
no-store | Do not cache at all | Authenticated/transactional pages |
must-revalidate | Once stale, must revalidate (do not serve stale) | HTML pages |
public | Shared caches (CDN) can store this response | Static assets, HTML |
private | Only browser cache, not CDN | Logged-in user pages |
immutable | Content will not change — no revalidation needed | Versioned static assets |
stale-while-revalidate=N | Serve stale while fetching fresh in background | HTML for fast TTFB |
Static assets (CSS, JS, images) — versioned with hash in filename:
Cache-Control: public, max-age=31536000, immutable
HTML pages (anonymous visitors):
Cache-Control: public, max-age=0, must-revalidate
or with CDN:
Cache-Control: public, s-maxage=3600, stale-while-revalidate=86400
HTML pages (logged-in users):
Cache-Control: private, no-cache
Checkout / cart / account:
Cache-Control: no-store
API responses (public):
Cache-Control: public, max-age=300, s-maxage=600
Sitemaps and robots.txt:
Cache-Control: public, max-age=3600
User browser
↓
Browser cache (private, per user)
↓
CDN edge (shared, per PoP — Cloudflare, Fastly, CloudFront, etc.)
↓
Reverse proxy / load balancer (Nginx, Varnish)
↓
Application cache (WP Rocket page cache, LiteSpeed Cache, PrestaShop CCC)
↓
Object cache (Redis, Memcached — DB query results)
↓
PHP runtime (OPcache — compiled PHP bytecode)
↓
Database (MySQL / MariaDB)
Each layer reduces load on the next. A CDN hit eliminates all layers below it. A page cache hit eliminates the PHP and database layers.
Both are validation mechanisms — they allow a client with a cached response to ask "has this changed?" without downloading the full response again.
Last-Modified:
Response: Last-Modified: Wed, 16 Apr 2026 10:00:00 GMT
Next request: If-Modified-Since: Wed, 16 Apr 2026 10:00:00 GMT
Server: 304 Not Modified (if unchanged) or 200 + new content
ETag:
Response: ETag: "abc123"
Next request: If-None-Match: "abc123"
Server: 304 Not Modified (if same) or 200 + new content
SEO relevance: ETags and Last-Modified enable Googlebot to efficiently re-crawl pages — if the content has not changed, Googlebot receives 304 and skips re-processing. This conserves crawl budget on large sites.
When ETags are a problem: Nginx and Apache can generate ETags that include inode numbers. On multi-server setups, different servers generate different ETags for the same file → cache validation fails → unnecessary full responses.
Fix for Nginx:
etag off; # or use FileETag MTime Size in Apache
| Plugin | Mechanism | Recommended stack |
|---|---|---|
| WP Rocket | File-based page cache | Nginx or Apache + LiteSpeed |
| LiteSpeed Cache | LiteSpeed server-native | Hostinger, LiteSpeed servers |
| W3 Total Cache | Multiple backends | VPS with Redis/Memcached |
| WP Super Cache | File-based | Basic shared hosting |
Page Cache:
Browser cache:
CDN integration:
Exclusions (important for e-commerce):
URLs to never cache:
/cart/
/checkout/
/my-account/
/order-received/
Cookies that bypass cache:
woocommerce_cart_hash
woocommerce_items_in_cart
wp_woocommerce_session_
Common misconfiguration — X-Robots-Tag on XML files:
LiteSpeed may apply X-Robots-Tag: noindex to all XML responses including sitemaps.
Fix: LiteSpeed Cache > Advanced > Excludes > Do Not Cache URIs > /sitemap*.xml
Cache purge on publish:
LiteSpeed Cache automatically purges page cache when a post is published or updated.
Verify this is working: publish a post and check the response headers for the page —
X-LiteSpeed-Cache: miss confirms a fresh request was served.
Separate mobile cache — WP Customizer CSS stripped:
LiteSpeed Cache can maintain separate cached versions for desktop and mobile (detected
by User-Agent). When CSS is added via WP Customizer (Additional CSS), LiteSpeed's CSS
optimization strips the <style id="wp-custom-css"> block when building the mobile
cache. Result: CSS works for logged-in admins (who bypass cache) and in DevTools mobile
simulation (which uses the desktop cache), but not on real mobile devices.
Diagnosis:
# Fetch with mobile UA and check for wp-custom-css block
curl -s -A "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 Mobile/15E148 Safari/604.1" \
https://domain.com/page/ | grep -i "wp-custom-css\|font-size"
# If wp-custom-css is absent from the HTML, LiteSpeed is stripping it
Fix — use Code Snippets plugin (scope site-css) instead of WP Customizer:
Code Snippets generates a dedicated external stylesheet (?code-snippets-css=1) that
LiteSpeed includes correctly in the HTML for all devices. The WP Customizer inline
<style> block is unreliable with LiteSpeed CSS optimization enabled.
# Create CSS snippet via Code Snippets REST API
curl -X POST https://domain.com/wp-json/code-snippets/v1/snippets \
-H "Authorization: Basic <base64(user:app-password)>" \
-H "Content-Type: application/json" \
-d '{"title":"my-css","code":".selector { property: value !important; }","scope":"site-css","active":true}'
# Then purge LiteSpeed cache manually from WP Admin
Note: WP Admin may be blocked by Cloudflare for scripted requests. In that case the cache purge must be triggered manually from the WordPress dashboard.
Object cache stores database query results in memory. Eliminates repeated identical queries to MySQL.
// wp-config.php
define('WP_CACHE_KEY_SALT', 'unique-site-key');
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
Object cache reduces TTFB on pages with complex WP_Query calls (WooCommerce shop, custom post type archives, widgets pulling recent posts).
Path: Advanced Parameters > Performance > CCC
| Option | Effect | Recommended |
|---|---|---|
| Smart cache for CSS | Combines and compresses CSS | On |
| Smart cache for JavaScript | Combines and compresses JS | On |
| Minify HTML | Removes whitespace from HTML | On |
| Compress inline JavaScript | Minifies inline JS | On |
| Move JavaScript to end | Defers JS to before </body> | On |
Warning: CCC can break custom themes. Test on staging first.
Path: Advanced Parameters > Performance > Smarty
| Setting | Production value |
|---|---|
| Cache compilation | Never recompile template files |
| Cache | Enabled |
| Caching type | File system |
PrestaShop does not include a built-in full-page cache. Options:
Configure cache bypass for:
/order/ (checkout)/cart/PHPSESSID cookie set# In http block
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=WORDPRESS:100m
inactive=60m max_size=1g;
# In server block
set $skip_cache 0;
# Bypass cache for logged-in users and WooCommerce
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|woocommerce_cart_hash|woocommerce_items_in_cart") {
set $skip_cache 1;
}
if ($request_uri ~* "/wp-admin/|/wp-login.php|/cart/|/checkout/|/my-account/") {
set $skip_cache 1;
}
fastcgi_cache WORDPRESS;
fastcgi_cache_valid 200 301 302 1h;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
add_header X-FastCGI-Cache $upstream_cache_status;
# CSS, JS, fonts — long cache with versioning assumption
location ~* \.(css|js|woff2|woff|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
}
# Images
location ~* \.(jpg|jpeg|png|gif|webp|avif|svg|ico)$ {
expires 1y;
add_header Cache-Control "public, max-age=31536000";
}
# Sitemaps and feeds — shorter TTL
location ~* \.(xml|txt)$ {
expires 1h;
add_header Cache-Control "public, max-age=3600";
}
Most CDNs (Cloudflare, Fastly, CloudFront) cache:
To cache HTML, you must configure a cache rule:
Cloudflare — cache HTML with short TTL:
Rule: Cache Everything
Edge TTL: 1 hour
Bypass cache: Cookie contains "wordpress_logged_in" OR URI contains "/wp-admin/"
Effect: TTFB drops from 400-800ms (origin) to 10-50ms (CDN edge).
When you publish new content, the CDN must serve the new version. Options:
Google published guidance on this on 11/11/2026 (https://developers.google.com/search/blog/2026/11/crawling-cdn, read 20/11/2026). Two failures show up in audits after a CDN migration:
1. Origin overloaded right after the switch. "Caches only shield you on the second visit": with cold caches, every Googlebot request is a miss that reaches the origin, and crawling often rises after an infrastructure change. Google's recommendations:
seo-logs skill).429 or 503 for "a few hours, or 1-2 days at most". Longer
is outside what Google recommends for this brake. Never 403.2. Googlebot blocked by the CDN's bot protection. Bot fight modes, challenge pages and "block all automated clients" rules stop verified crawlers too. Google's rule: "If you need to block bots, allow verified bots in your CDN and firewall settings" and "exempt verified crawlers from bot challenges". Target specific unwanted bots in robots.txt or with rules, instead of blocking all automation. Verify Google's IPs with https://developers.google.com/crawling/docs/crawlers-fetchers/verify-google-requests.
Audit check after any CDN change: run the URL Inspection live test in GSC on key URLs and
confirm a 200 with the real HTML, not a challenge page. A curl with a Googlebot user
agent does not prove anything here: a well-configured verified-bot rule should block it,
because it comes from a non-Google IP. Then watch GSC > Settings > Crawl stats for a rise
in 4xx/5xx or "host had problems" over the following two weeks.
respect_origin no tiene nada que respetarCombinación muy común (WordPress + LiteSpeed Cache + Cloudflare) con un fallo silencioso que no aparece en ningún panel: el HTML apenas se cachea en el edge y el TTFB de campo se dispara a 2 s o más, mientras que cada petición individual que se prueba a mano parece rápida.
La causa: LiteSpeed Cache emite x-litespeed-cache-control: public,max-age=604800, una
cabecera propietaria que Cloudflare no interpreta, y no emite ningún Cache-Control
estándar. Si la Cache Rule de Cloudflare usa Edge TTL: respect origin, Cloudflare no
encuentra ninguna directiva que respetar y cae a sus heurísticas por defecto, reteniendo el
HTML unos pocos segundos. Cada expiración cuesta un render PHP completo.
Cómo confirmarlo — comparar la respuesta con y sin que aplique la Cache Rule. Enviar una cookie de sesión de WordPress hace que la regla no aplique y devuelve la respuesta del origen tal cual:
# Origen directo (la regla de CF no aplica por la cookie)
curl -sI -H 'Cookie: wordpress_logged_in_x=1' "https://example.com/post/?x=$RANDOM" \
| grep -iE 'cache-control|x-litespeed|cf-cache-status'
# Con la regla de CF aplicando
curl -sI "https://example.com/post/?x=$RANDOM" \
| grep -iE 'cache-control|x-litespeed|cf-cache-status'
Diagnóstico según lo que aparezca:
| Observación | Significado |
|---|---|
El origen no devuelve Cache-Control, solo x-litespeed-cache-control | respect_origin es inservible → usar override_origin con TTL explícito |
Cache-Control: no-store aparece solo cuando la regla aplica | Lo genera browser_ttl: bypass de la propia regla. Instruye al navegador, no al edge. No es la causa del problema de caché |
x-litespeed-cache: miss siempre, incluso repitiendo la misma URL | La caché de página de LiteSpeed no sirve nunca (ver abajo) |
El fix es dejar de depender del origen para el TTL del edge:
Cloudflare → Caching → Cache Rules → [tu regla de HTML]
Edge TTL: Override origin → 4 hours
Browser TTL: Bypass (correcto para HTML: el visitante siempre recibe contenido fresco)
Vía API, conservando el resto de la regla intacta:
curl -X PUT "https://api.cloudflare.com/client/v4/zones/$ZONE/rulesets/$RULESET" \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"rules":[{"action":"set_cache_settings","description":"Cache HTML anon",
"expression":"<tu expresion original>","enabled":true,
"action_parameters":{"cache":true,"browser_ttl":{"mode":"bypass"},
"edge_ttl":{"mode":"override_origin","default":14400}}}]}'
Exporta primero el ruleset actual (GET .../rulesets/phases/http_request_cache_settings/entrypoint)
como respaldo: el PUT reemplaza el conjunto completo de reglas, no hace merge.
x-litespeed-cache: miss permanente es un problema aparte. Si el servidor responde miss
en todas las peticiones —incluso pidiendo dos veces seguidas la misma URL contra el origen y en
todos los tipos de página— la caché de página de LiteSpeed no está sirviendo, aunque el plugin
esté activo y marque la página como cacheable. La causa habitual es que falten las reglas del
servidor en el .htaccess:
<IfModule LiteSpeed>
CacheLookup on
</IfModule>
Requiere acceso al servidor o al hosting; no es diagnosticable ni corregible desde la API de WordPress. Con Cloudflare bien configurado el impacto en usuarios queda absorbido, pero cada purga del CDN vuelve a costar un render PHP completo y el origen queda expuesto si el CDN falla.
# Check what cache headers a URL is returning
curl -I https://domain.com/page/ 2>&1 | grep -i "cache\|x-cache\|age\|etag\|last-modified"
Key headers to read:
| Header | Value | Meaning |
|---|---|---|
Cache-Control: no-store | — | Response will never be cached |
X-Cache: HIT | — | CDN served from cache |
X-Cache: MISS | — | CDN fetched from origin |
Age: 3600 | seconds | Response has been cached for 3600s |
CF-Cache-Status: DYNAMIC | Cloudflare | HTML not being cached |
X-LiteSpeed-Cache: hit | LiteSpeed | Served from LiteSpeed cache |
Cache-Control: no-store on all HTML (PrestaShop default)
PrestaShop ships with no-store on all HTML responses to prevent caching of
session-aware pages. Fix: enable CCC and Smarty cache (see PrestaShop section).
Cache-Control: private on anonymous pages
WordPress plugins or themes that set private prevent CDNs from caching pages
that could be safely cached for anonymous visitors.
No cache headers at all
Old PHP applications or misconfigured servers may emit no Cache-Control header. Browsers default to heuristic caching (usually 10% of the Last-Modified age). Explicit headers are always better.
Cache headers correct but TTFB still high
CDN is configured but HTML is bypassing it (CF-Cache-Status: DYNAMIC).
Check CDN rules — HTML may need an explicit "Cache Everything" rule.
CRITICAL
[ ] HTML pages return Cache-Control header (not absent)
[ ] Cart, checkout, and account pages return Cache-Control: no-store
[ ] No Cache-Control: no-store on anonymous HTML pages
[ ] Sitemap does not return X-Robots-Tag: noindex (LiteSpeed issue)
HIGH
[ ] TTFB < 800ms on primary pages (PSI field data or curl)
[ ] Page caching active (WP Rocket, LiteSpeed, Smarty)
[ ] Static assets (CSS, JS, images) have long max-age (>1 year)
[ ] CDN configured and serving static assets (X-Cache: HIT or CF-Cache-Status: HIT)
MEDIUM
[ ] CDN caching HTML for anonymous visitors (not just assets)
[ ] OPcache active for PHP (check php.ini or phpinfo())
[ ] Redis/Memcached for WordPress object cache (high-traffic sites)
[ ] ETag configuration on multi-server setups (no inode-based ETags)
[ ] PrestaShop: CCC active with all options enabled
LOW
[ ] Cache-Control: immutable on versioned static assets
[ ] stale-while-revalidate configured for HTML responses
[ ] Cache purge on content publish (CDN invalidation)
[ ] Age header present on CDN responses (confirms caching is active)
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
Generated from the plugin's indexed repository (carlosuhart/seo-audit-skills) — no native marketplace selected
npx claudepluginhub p/uhartharper-seo-audit-skills46 skills in this plugin
/accesibilidad-wcagAuditoría de accesibilidad web contra WCAG 2.2 AA sobre sitios en vivo: axe-core 4.14 en escritorio, móvil y estados (menú, diálogo, formulario con errores sin enviar nada), recorrido real de teclado (foco visible por píxeles, foco tapado por cookies o cabecera fija, foco en contenido oculto, trampas, enlace de salto), reflow a 320 px, zoom 200%, espaciado 1.4.12 y árbol de accesibilidad; consolidación por criterio con severidad, confianza y patrón, protocolo manual con lector de pantalla y contexto legal fechado (EAA, España, ADA, Chile, Brasil). Use when user says "accesibilidad", "auditoría de accesibilidad", "WCAG", "es accesible", "lector de pantalla", "navegación con teclado", "contraste", "European Accessibility Act", "a11y" o "accessibility audit". No para revisar usabilidad general (ux-heuristica), velocidad (core-web-vitals) ni preparación para agentes de IA (seo-agentic), aunque las cita.
/ads-asistentes-iaEvalúa la publicidad dentro de asistentes de IA para un cliente: qué plataformas venden anuncios hoy (ChatGPT Ads, anuncios en Google AI Overviews y AI Mode, Microsoft Copilot, Amazon Alexa for Shopping) y cuáles no (Perplexity, Gemini, Meta AI, Grok), elegibilidad por país e idioma, encaje por tipo de negocio (B2B, SaaS, e-commerce, local), forma de compra y presupuesto, medición en GA4 y Ads, riesgos y coordinación con SEO y GEO. Entrega un informe de evaluación con escenarios y piloto propuesto. Use when user says "anuncios en ChatGPT", "publicidad en IA", "publicidad en asistentes de IA", "ads en AI Mode", "anuncios en AI Overviews", "Perplexity ads", "Copilot ads", "ChatGPT Ads", "AI ads", "advertising in AI assistants" or "¿conviene invertir en anuncios en IA?". Not for organic AI citations (seo-geo), generic Google or Meta campaign management (paid-ads) or ad copy production (ad-creative).
/canonicalAuditoría e implementación de canonical: self-referencing, paginación, parámetros, conflictos con hreflang, cadenas, canonicals heredados y bugs por CMS (Yoast, Rank Math, WooCommerce, PrestaShop), incluido el canonical como causa de problemas de indexación o canibalización.
/ccpaAuditoría CCPA/CPRA (California): umbrales de aplicación, 8 derechos del consumidor, opt-out y contratos con proveedores, con informe de score y sanciones en USD. Sub-skill de /privacidad, también invocable sola.
/core-web-vitalsCore Web Vitals diagnosis and fixes (LCP, CLS, INP, TTFB): field vs lab data, CrUX, a diagnostic tree per metric and fixes for WordPress (Divi, Elementor, WP Rocket), PrestaShop and Shopify. Use for CWV scores or performance issues.
/ga4-ai-trafficTráfico real referido desde AI Search (ChatGPT, Perplexity, Gemini, Copilot, Claude, Grok, Meta AI) con datos de GA4. Usar con "tráfico desde ChatGPT", "AI referral traffic" o "visitas desde IA". No confundir con geo-platform-audit (percepción de marca) ni con seo-geo (citabilidad).