You
My CDN cache hit rate sits at 41% and I cannot work out why.
ChatGPT
Start from what is being missed rather than the aggregate. The usual causes, in the order they occur:
- a
Set-Cookieon responses that should be anonymous, which makes them uncacheable Cache-Control: privateinherited from a framework default- query strings used for analytics that fragment the cache key
Vary: User-Agent, which effectively gives every device its own copy
You
It was the query strings. Analytics parameters on every link.
ChatGPT
Then normalise the key rather than removing the parameters. Most CDNs let you ignore a list of query parameters when computing the cache key, so analytics keeps working while ?utm_source=twitter stops creating a separate object.
ChatGPT
91% is roughly the ceiling for a site with any personalised surface at all. Chasing the last few points usually means caching authenticated responses, which is where cache bugs turn into data leaks.
