Glossary
Mismatched user agent: when your client contradicts itself
A mismatched user agent is the situation where the browser named in the User-Agent header does not agree with what other parts of the same request reveal about the client.
Definition
A single request carries several independent descriptions of its client: the User-Agent header, the Sec-CH-UA client hints, the TLS handshake, the HTTP/2 framing and, once the page loads, dozens of JavaScript properties. A real browser produces a set that fits together naturally. A mismatch is any disagreement among them, and detection systems weigh it heavily because honest clients almost never produce one.
Common mismatches
| Header claims | Other layer shows | Typical cause |
|---|---|---|
| Chrome 131 | TLS handshake of an HTTP library | Spoofed header on a plain script |
| Windows | Sec-CH-UA-Platform: "Linux" | Header changed, hints left alone |
| Chrome 131 | Sec-CH-UA lists version 120 | Old browser binary with a new string |
| iPhone Safari | Desktop screen size, no touch support | Header only mobile emulation |
| Firefox | Chrome only APIs present in JavaScript | Chrome browser with a Firefox string |
| macOS | WebGL renderer naming a software rasterizer | Headless Linux server |
Why mismatches weigh so much
Unusual values can belong to real people: a rare GPU, an old OS, an exotic language. Contradictions, by contrast, have almost no innocent explanation. A browser does not misreport its own platform in one header and correct it in the next. So while a site may tolerate a rare profile, it treats an inconsistent one as evidence that someone edited the request, and edited requests are mostly automated.
Where the checks happen
At the edge
CDNs compare the header with the TLS fingerprint and HTTP/2 settings before the request reaches the site. This catches script clients with browser strings.
In the page
A detection script compares navigator.userAgent, navigator.userAgentData, platform, screen, fonts and rendering output. This catches browsers configured with a foreign identity.
Across requests
Some systems remember the profile seen at login and compare later requests in the same session. A User-Agent that changes after a cookie was issued is a mismatch over time.
Lining the layers up
- Decide which browser and platform you are presenting, ideally the one you actually run.
- Use a client whose TLS and HTTP/2 behavior match that browser version.
- Send client hints consistent with the header, or let a real browser generate them.
- Match viewport, touch support and device pixel ratio to the device type.
- Keep the same identity for the whole session, including when reusing cookies.
Treat the identity as a single object in your code, with the header, hints, viewport, locale and proxy region stored together, and build every request from it. Scattering these values across separate config files is how mismatches creep in after an update.
A short test loop helps: load a page that echoes headers and runs a few property checks, once from your automation and once from a normal browser, then diff the results.
Mismatches and solved challenges
Solving a challenge does not erase a mismatch. If you receive a Cloudflare Challenge cookie for one User-Agent and then send requests with another, the cookie stops working. With token tasks such as reCAPTCHA v2 Enterprise, GateSolver returns the User-Agent used during solving; submit the token with that header when the site validates the pairing. Keeping these values together in one session object in your code prevents most of these errors. The guide why sites think you are a bot walks through diagnosing a flagged session.
Common questions
What is the most common user agent mismatch?
A browser User-Agent string sent from an HTTP library whose TLS handshake identifies the library instead.
Can a real person ever trigger a mismatch?
Rarely, for example with privacy extensions that alter some values but not others, which is why sites usually challenge rather than block.
Do I need to send client hints from a script?
If you claim a Chromium browser, sending hints that agree with the header makes the request more consistent.
How do I find which layer disagrees?
Compare your automation against a normal browser on an echo page for headers, TLS and JavaScript properties.
Why did my clearance cookie stop working mid session?
Often because the User-Agent or proxy changed after the cookie was issued; both must stay the same.
Keep reading
- User agent spoofingSending a different User-Agent than your real client, and the other signals that must change with it to be believable.
- Client hints (Sec-CH-UA)The Sec-CH-UA family of request headers, which hints are sent by default, and how they must agree with the User-Agent.
- TLS fingerprintingThe ClientHello message reveals which library opened the connection, which is why Python requests never looks like Chrome.
- Why a site thinks you are a botThe network, browser and behavior signals that make a site label traffic as automated, and the honest fix for each one.