carlosuhart/seo-audit-skills/cache-headers

Claude Code and agent skill by carlosuhart/seo-audit-skills

Trust tier 3
  • community
  • ext:[{"type":"plugin","description":"Custom plugin integration"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Cache architecture for SEO: Cache-Control, CDN vs browser cache, ETag and Last-Modified, and CMS setups (WP Rocket, LiteSpeed, PrestaShop, Nginx/Apache). Use for TTFB issues, caching layers or cache header audits.

Install

npx vskill@latest install carlosuhart/seo-audit-skills/cache-headers

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as carlosuhart/seo-audit-skills/cache-headers.

Cache Headers & Caching Strategy — Technical SEO

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.

Cache-Control directives reference

DirectiveMeaningUse case
max-age=NBrowser can cache for N secondsStatic assets
s-maxage=NCDN/shared cache can cache for N secondsCDN-specific TTL
no-cacheMust revalidate with server before using cacheHTML pages
no-storeDo not cache at allAuthenticated/transactional pages
must-revalidateOnce stale, must revalidate (do not serve stale)HTML pages
publicShared caches (CDN) can store this responseStatic assets, HTML
privateOnly browser cache, not CDNLogged-in user pages
immutableContent will not change — no revalidation neededVersioned static assets
stale-while-revalidate=NServe stale while fetching fresh in backgroundHTML for fast TTFB
Combinations by content type
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

Cache layers architecture

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.


ETag and Last-Modified

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:

nginx
etag off; # or use FileETag MTime Size in Apache

WordPress caching

Page cache — plugin options
PluginMechanismRecommended stack
WP RocketFile-based page cacheNginx or Apache + LiteSpeed
LiteSpeed CacheLiteSpeed server-nativeHostinger, LiteSpeed servers
W3 Total CacheMultiple backendsVPS with Redis/Memcached
WP Super CacheFile-basedBasic shared hosting
WP Rocket configuration

Page Cache:

  • Settings > Cache > Enable caching for mobile devices: on
  • Separate cache for mobile: on (if theme is responsive, keep off)
  • Cache lifespan: 10 hours (adjust to content update frequency)

Browser cache:

  • Settings > Browser Caching > on
  • WP Rocket handles Cache-Control headers for static assets

CDN integration:

  • Settings > CDN > CDN hostname: your CDN URL
  • This rewrites asset URLs to the CDN hostname

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_
LiteSpeed Cache

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:

bash
# 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.

bash
# 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.

Redis object cache

Object cache stores database query results in memory. Eliminates repeated identical queries to MySQL.

php
// 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).


PrestaShop caching

CCC (Combine, Compress, Cache)

Path: Advanced Parameters > Performance > CCC

OptionEffectRecommended
Smart cache for CSSCombines and compresses CSSOn
Smart cache for JavaScriptCombines and compresses JSOn
Minify HTMLRemoves whitespace from HTMLOn
Compress inline JavaScriptMinifies inline JSOn
Move JavaScript to endDefers JS to before </body>On

Warning: CCC can break custom themes. Test on staging first.

Smarty cache

Path: Advanced Parameters > Performance > Smarty

SettingProduction value
Cache compilationNever recompile template files
CacheEnabled
Caching typeFile system
Full-page cache for PrestaShop

PrestaShop does not include a built-in full-page cache. Options:

  1. Varnish in front of the application server — caches full HTML responses
  2. Nginx FastCGI cache — caches PHP-FPM responses at the web server level
  3. Third-party module — available on PrestaShop Addons marketplace

Configure cache bypass for:

  • /order/ (checkout)
  • /cart/
  • Any URL with PHPSESSID cookie set

Nginx caching configuration

FastCGI page cache
nginx
# 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;
Static asset cache headers
nginx
# 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";
}

CDN caching

What CDNs cache by default

Most CDNs (Cloudflare, Fastly, CloudFront) cache:

  • CSS, JS, images, fonts — yes, by default
  • HTML — no, not by default (treated as dynamic)

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).

Cache invalidation

When you publish new content, the CDN must serve the new version. Options:

  1. Short TTL (1h): cache expires automatically. Simple but means stale content

for up to 1 hour after a change.

  1. Cache purge on publish: WordPress plugins (WP Rocket, LiteSpeed) can purge

the CDN cache for specific URLs when content is updated.

  1. Cache-Control: stale-while-revalidate: serve stale while fetching fresh

in background — best user experience.

Moving a site to a CDN — the crawl spike and the bot wall

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:

  • Pre-warm the cache before cutting over: request the high-traffic URLs, the ones

expected to peak, and the most crawled ones through the CDN "at a controlled pace". The most crawled URLs come from the server logs (see the seo-logs skill).

  • Temporary brake: answer 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.

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
5
Repository forks
1
7-day trend score
14

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • pluginCustom plugin integration

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/carlosuhart/seo-audit-skills/cache-headers/badge)](https://verified-skill.com/skills/carlosuhart/seo-audit-skills/cache-headers)

Something wrong with this skill or its page? Tell us.