HTTP Vary: User-Agent Header
HTTP response header indicating that a server returns different HTML payloads depending on the client's User-Agent string (traditionally used for dynamic serving of distinct mobile vs. desktop HTML at the same URL).
Verified
Syntax / Example
Vary: Accept-Encoding
Verify On A Live URL
curl -sI https://example.com/ | grep -i "^vary:"
Documented Facts For HTTP Vary: User-Agent Header
| Metric or Rule | Documented Value | Source |
|---|---|---|
| Required when | Dynamic Serving (different mobile/desktop HTML at same URL) | Google: HTTP Status Codes & SearchChecked November 25, 2026 |
| Responsive site best practice | Use Vary: Accept-Encoding (omit User-Agent) | RFC 9110: HTTP SemanticsChecked November 25, 2026 |
| Performance hazard | Fragments CDN edge cache by browser version string | web.dev: Preload Critical Assets & LCP OptimizationChecked November 27, 2026 |
Official Specification & Google Behavior
Google Search Central requires Vary: User-Agent ONLY if your server uses Dynamic Serving (serving distinct HTML for mobile vs. desktop at the exact same URL). Responsive sites serving identical HTML should omit it to protect CDN cache hit ratios.
SEO & Indexing Impact
Unnecessary Vary: User-Agent on a responsive site fragments CDN edge caches across thousands of unique browser strings, destroying cache hit rates and degrading mobile TTFB/LCP.
Backlink Monitoring Verdict
Never serve different outbound links or rel attributes to Googlebot versus human browsers (that violates Google's Cloaking spam policy).
Common Pitfalls
- Leaving Vary: User-Agent enabled on a responsive Next.js/WordPress site and collapsing Cloudflare/Vercel CDN cache hit rates to <10%.
- Serving stripped HTML or hidden links exclusively to Googlebot User-Agent, triggering a Cloaking manual action.
Frequently Asked Questions
- Should a responsive website send Vary: User-Agent?
- No—if your site serves identical responsive HTML to mobile and desktop browsers, omit Vary: User-Agent so CDNs cache one fast copy for everyone.
- When does Google require Vary: User-Agent?
- Only when you use Dynamic Serving (delivering substantially different HTML templates to mobile vs. desktop browsers at the same URL).
- Why does Vary: User-Agent slow down TTFB?
- CDNs must store separate cache entries for every unique browser User-Agent string, causing constant cache misses and slow origin hits.
Primary Sources
Verified
- RFC 9110: HTTP SemanticsNovember 25, 2026
- Google: HTTP Status Codes & SearchNovember 25, 2026
- web.dev: Preload Critical Assets & LCP OptimizationNovember 27, 2026
Related Research Guides
- November 27, 2026WordPress Vs Shopify Vs Webflow Vs Next.js Technical SEO: Core Web Vitals And AI Crawlers DataCompare real 28-day CrUX Core Web Vitals pass rates, zero-JS AI crawler readability and technical traps across WordPress, Shopify, Webflow & Next.js.
- November 10, 2026Core Web Vitals: Thresholds, Real Pass Rates And Ranking Impact56.3% of origins pass Core Web Vitals in October 2026. See the LCP, INP and CLS thresholds, the real pass rates and the ranking effect.
- November 27, 2026Chrome DevTools And Curl For Technical SEO: 15 Zero-Cost Header, JS And CWV DiagnosticsCatch hidden X-Robots-Tag noindex headers, WAF 403 AI bot blocks, TTFB > 800ms and CSR JS drift in seconds using copy-paste curl and DevTools.