HTTP status codes for SEO & link checks

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 RuleDocumented ValueSource
Required whenDynamic Serving (different mobile/desktop HTML at same URL)Google: HTTP Status Codes & SearchChecked November 25, 2026
Responsive site best practiceUse Vary: Accept-Encoding (omit User-Agent)RFC 9110: HTTP SemanticsChecked November 25, 2026
Performance hazardFragments CDN edge cache by browser version stringweb.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

Related Research Guides