# Vary header

Category: [Technical SEO](https://seo-geo-glossary.com/en/glossary/category/technical-seo/) › [Servers, HTTP & caching](https://seo-geo-glossary.com/en/glossary/category/technical-seo/servers-http-caching/)

The **Vary header** is an HTTP response header that lists which request headers influenced the response, so that caches store and serve each variant separately.

## How does the Vary header work?
Per MDN, `Vary` describes the parts of a request, apart from method and URL, that shaped the response. A cache then stores one copy per combination of the listed header values. `Vary: *` means that factors beyond request headers played a role, which makes the response uncacheable. MDN also says the same `Vary` value should be sent on all responses for a URL, including 304 responses.

Typical values are `Accept-Encoding` (compressed and uncompressed copies), `Accept-Language` and `User-Agent`.

For SEO, Google's mobile-first indexing documentation names `Vary: user-agent` as part of dynamic serving, where the same URL returns different HTML to different devices. The header tells caches that the response depends on the user agent. Responsive pages with one HTML for all devices do not need it.

## Example
```http
HTTP/1.1 200 OK
Vary: Accept-Encoding, User-Agent
```

## Common mistakes
`Vary: User-Agent` is set on pages that return identical HTML, which splits the cache into many copies without benefit.

## Mobile site configurations compared

| Configuration | URL | HTML | Technical signals | Google's position |
|---|---|---|---|---|
| Responsive design | same URL on every device | same HTML; the layout adapts to the screen size | none needed; content and metadata are identical on mobile and desktop | recommended as the easiest pattern to implement and maintain |
| Dynamic serving | same URL on every device | different HTML per device, chosen by user-agent detection | Vary: user-agent response header | supported; the mobile version needs the same content as desktop |
| Separate mobile URLs | a separate URL per device, e.g. m.example.com | different HTML per device | mobile page: rel="canonical" to the desktop URL; desktop page: rel="alternate" with media to the mobile URL; redirects based on user agent and Vary | supported; the desktop URL is always canonical, and hreflang links mobile to mobile and desktop to desktop |

Sources: [Google Search Central: Mobile site and mobile-first indexing best practices (last updated 2025-12-10)](https://developers.google.com/search/docs/crawling-indexing/mobile/mobile-sites-mobile-first-indexing); [MDN: Vary header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Vary). Last checked: October 8, 2026

## Related terms

- [HTTP header](https://seo-geo-glossary.com/en/glossary/http-header/index.md)
- [Cache-Control](https://seo-geo-glossary.com/en/glossary/cache-control/index.md)
- [Dynamic serving](https://seo-geo-glossary.com/en/glossary/dynamic-serving/index.md)
- [Last-Modified header](https://seo-geo-glossary.com/en/glossary/last-modified-header/index.md)

## Sources

- [Vary header – MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Vary)
- [RFC 9110: Vary](https://www.rfc-editor.org/rfc/rfc9110.html#name-vary)
- [Mobile-first indexing best practices – Google Search Central](https://developers.google.com/search/docs/crawling-indexing/mobile/mobile-sites-mobile-first-indexing)

---

Last updated: October 8, 2026
URL: https://seo-geo-glossary.com/en/glossary/vary-header/
