Skip to main content
InfoConfigOWASP A05:2021CWE-200

How to fix: X-Cache-Hits Exposes Cache Hit Count

Some CDNs (Cloudflare, Fastly) include X-Cache-Hits to indicate how many times an asset was served from cache. This leaks traffic patterns and caching topology.

Why it matters

X-Cache-Hits lets attackers count how many times a resource has been fetched, revealing relative popularity of resources and potentially enabling cache-timing attacks to infer user activity.

X-Cache-Hits is a CDN diagnostic header that counts cache hits per resource per edge node. It has no value for end users and leaks CDN behavior and request popularity data.

How to fix it

  1. 1Strip X-Cache-Hits using a CDN response header transform rule.
  2. 2In Cloudflare: use Transform Rules to remove the header. In Fastly: use VCL to unset resp.http.X-Cache-Hits.

Code examples

Fastly VCL

VCL
sub vcl_deliver {
  unset resp.http.X-Cache-Hits;
  unset resp.http.X-Cache;
  return(deliver);
}

References

Detected automatically by VulnRadar. The check id is x-cache-hits, stable across every scan so you can filter or diff on it.

See every config check

Questions

How severe is X-Cache-Hits Exposes Cache Hit Count?
VulnRadar rates this info severity in the config category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id x-cache-hits, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does X-Cache-Hits Exposes Cache Hit Count map to?
It maps to CWE-200. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for x-cache-hits exposes cache hit count

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: X-Cache-Hits Exposes Cache Hit Count | VulnRadar