This week in caching: the Vary header trap
One header turned a cache into confetti. The cleanups:
— Responsive site — Vary: User-Agent meant a unique cache entry per browser string (millions of variants); the cache never warmed. Removing it (the site was truly responsive, same HTML) took hit rate from 12% to 89%.
— i18n store — replacing Vary: Cookie with a normalized 'language' cache key cut variants from thousands to 6.
— API — Vary: Accept-Encoding kept (correct) but Vary: * from a misconfigured plugin was disabling caching entirely; removing it restored 90% hit rate.
The rule: every value in a Vary header multiplies your cache entries. Vary on the fewest dimensions that actually change the response.
Bookmark: curl -I and inspect Vary on key URLs — Vary: User-Agent or * is almost always a bug.
Cache Catch
@CacheCatch
This week in caching: the Vary header trap
Этот пост опубликован в Telegram-канале Cache Catch. Подписаться можно по ссылке: @CacheCatch.