In the previous posts I described how ProxyMapService can make its upstream TLS handshake look like a real browser: Chrome-like TLS fingerprinting came first, and then TlsClientType replaced the old UseBoringSsl flag with a choice between Native, BoringSsl and Nss.
There was one catch. TlsClientType is a fixed setting: you pick one fingerprint for a port or a host, and every connection gets it. But the traffic going through the proxy usually comes from different clients. If a request with a Firefox User-Agent arrives with a Chrome ClientHello, the mismatch is itself a signal. Version 1.0.12 solves this with a fourth value, Auto, which chooses the fingerprint for each session from the client’s User-Agent.
TlsClientType = Auto (1.0.12)
Why you might need it
A browser-like fingerprint is only useful when it matches what the client claims to be. With a static BoringSsl setting, a Firefox client is fingerprinted as Chrome. With a static Nss setting, it is the other way around. Auto removes the need to choose: the proxy looks at the User-Agent and picks the matching TLS implementation.
How to enable
"SslClientOptions": {
"TlsClientType": "Auto"
}
Auto is resolved at the moment the upstream TLS handshake starts, using these rules:
| User-Agent | TLS implementation | ClientHello |
|---|---|---|
| Firefox | Nss |
Firefox-like |
Chrome, Edge (Edg/), Opera (OPR/), Chromium |
BoringSsl |
Chrome-like |
| Anything else (Safari, curl, bots) | Native |
system SslStream |
Edge and Opera are Chromium-based, so they get the Chrome-like fingerprint. Everything the proxy does not recognize falls back to the system TLS stack, exactly as before.
As with BoringSsl and Nss, Auto produces a browser-like fingerprint only when SSL decryption is enabled, because the proxy has to open its own upstream TLS connection. Without it, there is no ClientHello of the proxy’s own to shape.
Where the User-Agent comes from
The proxy uses the first User-Agent it can find, in this order:
- The client User-Agent stored in the sticky session.
- The
User-Agentheader of the incoming request. For HTTP proxying this is theCONNECTrequest. - Nothing known: for example, a SOCKS connection without a sticky session. In this case the proxy falls back to
Native.
The fingerprint is fixed when the upstream handshake completes. If the User-Agent changes later, the change affects only new connections, not the ones that are already established.
Client User-Agent in the Session API (1.0.12)
Sticky sessions now keep a client User-Agent, so the choice can be made even for connections that carry no User-Agent themselves, such as SOCKS.
You can set it explicitly when you create a session:
POST /session/new: add a top-levelUserAgentkey to the JSON body, next toUsernameParameters.GET /session/new?UserAgent=...: pass it as a query parameter. It is not treated as a username parameter.
For example, with curl. The request goes through the proxy, and proxymapper is the default SessionAPIConfig.Domain. With a query parameter (-G --data-urlencode lets curl encode the User-Agent for the URL):
curl -x http://127.0.0.1:5001 -G "http://proxymapper/session/new" \
--data-urlencode "UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
Or with a POST body:
curl -x http://127.0.0.1:5001 -X POST "http://proxymapper/session/new" \
-H "Content-Type: application/json" \
-d '{"UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0"}'
A session created by the first command gets the BoringSsl (Chrome-like) fingerprint, and one created by the second gets Nss (Firefox-like).
If you do not pass it, the User-Agent header of the Session API request itself is used. The current value is returned as user_agent in GET /session/.
Explicit and detected values
There are two kinds of values, and they behave differently:
- Explicit. A User-Agent that you set through the Session API is never overwritten by detection. It can only be replaced by another explicit value, cleared by
/session/reset, or dropped when the sticky session expires. - Detected. If you did not set one, every parsed HTTP request with a non-empty User-Agent updates the session value. This works for HTTP/1.1, HTTP/2,
CONNECTand plain requests. A SOCKS connection that comes later in the same session inherits the detected value.
This means a typical flow needs no extra work. A browser sends a few HTTP requests through the proxy, the session learns its User-Agent, and any later connection in that session gets a matching fingerprint.
Logging (1.0.12)
A new switch, DetailedLogging:LogClientUserAgent, is off by default. When it is on, the log shows the TlsClientType that was resolved for each connection, and it warns whenever the proxy fell back to Native because no User-Agent was known:
"DetailedLogging": {
"LogClientUserAgent": true
}
It is useful for checking that your clients are classified the way you expect.
Upgrading
The default configuration files (appsettings.json, appsettings.IIS.json and appsettings.Production-Example.json) now ship with "TlsClientType": "Auto" instead of "Native". Custom configurations keep their current values, so if you want Auto, set it yourself.
Two things to remember:
Autoneeds SSL decryption, the same asBoringSslandNss.- Without a known User-Agent, it silently uses the system TLS stack. Turn on
LogClientUserAgentif you want to see when that happens.