Cache Catch
Cache Catch
@CacheCatch

Myth: Vary: User-Agent gives you mobile caching

This week in caching, the Vary footgun nobody warns about:
— The idea: add Vary: User-Agent to serve cached mobile and desktop variants.
— The reality: User-Agent strings are nearly unique per device/version, so every UA becomes its own cache key and your hit rate collapses toward zero. You've essentially disabled the cache.
— Worth your time: normalize to a coarse device class at the edge (a worker that maps UA to mobile/desktop) and Vary on a small custom header instead.
Bookmark: Vary multiplies your cache keys by the cardinality of the header's values. Never Vary on anything high-cardinality unless you've normalized it first.
This post was published in the Telegram channel Cache Catch (@CacheCatch). All its posts are on the channel page.
Open on Telegram

Latest posts in “Tools and infrastructure”

All channels in this category →

реклама в сети

Готовы запустить рекламу через сеть public.tg?

Новый оффер, продукт, GEO, кейс, событие или партнёрский запуск — соберём маршрут под задачу и отдадим медиаплан.

Telegram для медиаплана: @AFFtop_connect. Быстрый тест: $20 за канал, $1000 за пакет по сети.