Cache Catch
Cache Catch
@CacheCatch

This week in caching: Vary header vs separate URLs for variants

This week in caching: Vary header vs separate URLs for variants

Serving mobile/desktop or multi-language from one cache — two roads:

— Vary header (e.g. Vary: Accept-Encoding) keeps one URL and lets the cache store per-variant. Clean for encoding/compression. But Vary: User-Agent is a hit-rate killer — thousands of UA strings = thousands of cache entries for one page.
— Separate URLs (/en/, /de/, m.site.com): each variant is its own cacheable object with high hit rate, and it's SEO-friendly. Cost: routing/redirect logic and canonical tags.
— The middle path: normalize the varying input to a small set (UA → 'mobile'/'desktop' bucket) before it hits the cache key, so you get Vary's single-URL simplicity without the explosion.

Rule: Vary only on low-cardinality headers; for anything high-cardinality, bucket it or split the URL.

Bookmark: Smashing Magazine's 'Vary header' deep-dive on cache-key cardinality.
Этот пост опубликован в Telegram-канале Cache Catch. Подписаться можно по ссылке: @CacheCatch.
tech

Свежие посты в категории «Tech Infrastructure»

Все каналы категории →

start

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

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

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