HTTP caching • edge delivery • response negotiation

Vary Header Builder & Cache Key Planner

Build a safe Vary header for compression, language, origin, or device-specific responses. See how each selected request header affects cache fragmentation, when Vary: * is a bad idea, and copy deployment snippets without leaving the page.

Quick presets

Start from a common response pattern, then fine-tune if needed.

Header selection

Choose the request headers that truly change your response body or critical headers.

Output

A lean Vary header is better than an overfit one. Keep your cache key small.

Generated header
Vary: Accept-Encoding
Selected dimensions
1
Estimated fragmentation
Low
Cache recommendation
Shared cache OK
Analysis

    Server snippets

    Copy a starting point for your stack, then adapt it to your app logic.

    Node / Express
    
                
    Nginx
    
                
    Apache
    
                

    What should usually vary?

    • Good: Accept-Encoding for gzip/br differences.
    • Good: Accept-Language when server-rendered content changes by locale.
    • Careful: Origin only when your response changes per origin, often with reflected CORS headers.
    • Careful: User-Agent usually explodes cache keys. Prefer feature detection or normalized device buckets.
    • Avoid: Vary: * because it tells caches the response cannot be reused for other requests.