Vary: Tells caches which request headers affect the response. Without it, a cache might serve the wrong variant. The Vary response header tells caches which request headers affect the response. Vary: Accept-Encoding means the compressed and uncompressed versions must be cached separately. Vary: Accept-Language does the same per language. Without it, a shared cache or CDN might serve a gzip-compressed response to a client that cannot handle it, or a Dutch page to an English visitor.
Keep the list short. Vary: Cookie or Vary: User-Agent create so many variants that caching becomes almost useless. It is often better to use separate URLs for different versions, such as /nl/ for Dutch pages, which caches cleanly and is better for SEO too. Web servers usually add Vary: Accept-Encoding automatically when they compress responses.
Use when reviewing or setting HTTP response headers for a web app or API - security headers (Content-Security-Policy, Strict-Transport-Security, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy), CORS headers, caching headers (Cache-Control, ETag, Last-Modified, Vary) and cookies (Set-Cookie flags). Also use when a security scan reports missing headers.
'Expert-level browser automation, debugging, and performance analysis using Chrome DevTools MCP. Use for interacting with web pages, capturing screenshots, analyzing network traffic, and profiling performance.'
Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards.