# Network, user agent and proxy (/es/docs/browser/network)

Blocking and a resource cache, a coherent user agent, and a proxy per identity.

Everything on this page is off until you turn it on for an identity.

## Blocking and the resource cache [#blocking-and-the-resource-cache]

Both are off until `identity.json` asks for them, per identity:

```json
{
  "version": 2,
  "block": { "trackers": true, "types": ["image", "font"], "patterns": ["ads.example", "*/promo/*"] },
  "cache": { "maxSize": "100MB" }
}
```

```sh
turno-browser set school --block-trackers true --block-types image,font \
  --block-patterns 'ads.example,*/promo/*' --cache-max-size 100MB
# both off again
turno-browser set school --no-block --no-cache
```

`trackers` blocks a short built-in list of ad and analytics hosts; `types` takes `image`, `media`
and `font`; a pattern is a host name (with its subdomains) or a URL with `*`. The page itself is
never blocked. The cache keeps images, fonts, stylesheets and scripts on disk for this identity
only, as long as their `Cache-Control` allows, and never a response with `Set-Cookie` or a request
with `Authorization`. Requests still go out through Chrome. Turn the cache on with blocking:
blocking turns Chrome's own cache off.

## Network and user agent [#network-and-user-agent]

Two settings change how an identity's browser reaches sites, set per identity in `identity.json`
(format 11). Without a proxy of its own, an identity's Chrome follows the system's proxy, as your own Chrome does (see [the system's proxy](#the-systems-proxy)). The coherent user agent is on by default only in a
headless Chrome, which otherwise says `HeadlessChrome`, once turno has read that Chrome's client
hints (`turno-browser login` reads them when you close it, once per Chrome version, so no launch
pays for an extra Chrome); a Chrome with a window keeps its own, which is already coherent. These settings are for your own accounts and for sites you may automate, and
the choice is yours. Each one has a cost to weigh:

- a browser whose parts disagree (a user agent from one Chrome, client hints from another, a time
  zone that does not match the address) stands out more than one that changes nothing;
- many sites' terms forbid proxies or automated access, and a sign-in from a new network can lock
  an account until you confirm it is you;
- a proxy's operator sees which sites the identity visits, and the full content of plain `http://`
  pages.

```sh
turno-browser set school --user-agent coherent
turno-browser set school --proxy-server http://proxy.example.com:8080 \
  --proxy-username alice --proxy-password keychain:school-proxy
# the password, typed into the secret store
turno-browser secret set school-proxy
# the identity's proxy removed (Chrome follows the system's), and the user agent back to its default
turno-browser set school --no-proxy --user-agent ""
# Chrome's own user agent even in headless (format 14)
turno-browser set school --user-agent off
```

### A coherent user agent [#a-coherent-user-agent]

`"userAgent": "coherent"` takes no value of yours: turno builds the user agent from the Chrome you
have installed and never takes a typed string. A typed user agent says one thing while the client
hints, `navigator.platform`, WebGL, the fonts and the TLS handshake still say what the browser
really is, which is the inconsistency the setting is there to avoid. The Chrome version and the
platform are never configurable for the same reason: measured with Chrome 157, a page's dedicated
workers keep the real `navigator.platform` whatever the override, and a popup's first request
carries the real client hints platform.

What it does:

- **Headed**: nothing changes, since a headed Chrome already presents itself as it is. The launch
  check below still runs when you set `coherent`; the default leaves a headed Chrome alone.
- **Headless**: a headless Chrome says `HeadlessChrome` in its user agent while its client hints say
  `Google Chrome`. turno gives it the user agent a headed Chrome of the same version and OS sends
  (Chrome's `--user-agent` switch, which every request, popup and worker carries), and, since that
  switch alone blanks the client hints' full version list, architecture and platform version,
  gives each page those values back as this same Chrome reports them. They are read once per
  Chrome version by a short headless launch on a throwaway profile and kept in the state folder.
  Workers take them from their page, and a tab a tool opens has them before it loads. A popup a
  page opens gets them as soon as it exists, which can be after its first document loaded.
- **Languages and time zone** come from the identity (`--languages`, `--timezone`) or from the
  computer, as without the setting. They are set when Chrome starts (its own `--accept-lang` and
  `--lang`, and the `TZ` of its process), so workers read the same as their page.
- **The launch check**: before the agent gets the browser, turno loads a page of its own (answered
  inside Chrome, so nothing goes out) and compares what it reads: no `HeadlessChrome`, brands and
  full version list that name the Chrome that runs, the high entropy values this Chrome reports
  (on Linux Chrome reports an empty platform version, so turno does too), one platform in the user
  agent, the client hints and `navigator.platform`, the request's headers equal to what the page reads, the
  languages and time zone you asked for, and dates formatted in the first language. Any
  contradiction stops the launch with what disagreed. When the user agent came from the default
  and not from `identity.json`, a contradiction is reported on the server's stderr and Chrome
  starts again without it. On macOS Chrome takes the date and number
  format from the system language, not from flags, so languages that start with another language
  are refused there: start them with the system's, or change the macOS language.

`pnpm bench:fingerprint --configs default,user-agent-coherent,user-agent-coherent-tz` shows the
result: the headless token gone, and the headers, a worker, the client hints and the Intl locale
agreeing with the page.

### A proxy [#a-proxy]

`proxy.server` is an `http://`, `https://`, `socks4://` or `socks5://` URL with a host and port
only. The credentials never go in the URL or in `identity.json`: `proxy.password` is always a
`keychain:<item>` reference to the secret store (`turno-browser secret set <item>`), and `proxy.username`
is a name or a reference too. Chrome cannot sign in to a SOCKS proxy, so a SOCKS proxy takes no
credentials. turno reads them when the browser starts and hides the user name, the password and
their `Basic` encoding from every tool result; a missing item stops the start, so no request goes
out without the proxy. `turno-browser doctor` checks that the item exists without reading it.

All of the identity's traffic goes through the proxy, `turno-browser login` included, so a site
sees one network for both. WebRTC is limited to the proxy too, so a page cannot learn your own
address that way. Sites see the proxy's address, and its operator sees where you go.

### The system's proxy [#the-systems-proxy]

turno passes Chrome no proxy switch unless the identity or the server sets one, so Chrome reads the operating system's proxy settings on its own, PAC files and auto discovery included. turno reads the same settings only to say which proxy that is: `turno-browser show` and `status` name it (`proxy: on (auto: the system's: http://proxy.example.com:8080 (macOS network settings))`).

| System | Where turno reads it |
|---|---|
| macOS | `scutil --proxy`: the HTTPS, HTTP and SOCKS proxies, a PAC file and auto discovery |
| Windows | WinINET's per-user settings, `HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings` (`ProxyEnable`, `ProxyServer`, `ProxyOverride`, `AutoConfigURL`) |
| Linux | on GNOME and its relatives, `gsettings list-recursively org.gnome.system.proxy`; elsewhere `https_proxy`, `http_proxy`, `all_proxy`, `auto_proxy` and `no_proxy`, as Chrome reads them |

`"proxy": false` in identity.json (`turno-browser set <id> --proxy-server off`) keeps the identity off the system's proxy too: Chrome gets `--no-proxy-server` and connects directly. `--no-proxy` removes the key, so Chrome follows the system's again. Attach mode keeps your Chrome's own settings, and Camoufox follows Firefox's.

### Where the proxy exits [#where-the-proxy-exits]

With a proxy in use, the identity's, the server's or the system's, sites see the proxy's address, and a time zone or language from another country next to it is a difference a site can read. When the browser starts, turno asks [GeoJS](https://www.geojs.io/) for the exit's country and time zone, through the proxy, once a day per proxy, and compares them with the identity's time zone and locale. A mismatch shows in the next tool result, in the server's log and in `show` and `status`, with the value that would match:

```text
warning: the proxy exits in MX (America/Monterrey), but the identity's time zone is Europe/Madrid: set --timezone America/Monterrey
```

Zones with the same offset (`America/Monterrey` and `America/Mexico_City`) agree. The lookup sends no cookie, no identity name and no header but the host and a generic user agent; only the country and time zone are kept, in the identity's state folder. A PAC file or auto discovery is not resolved, so those proxies are not checked. `TURNO_BROWSER_EXIT_CHECK=0` turns the lookup off; see [What leaves your machine](/docs/browser/what-leaves-your-machine).

### With the other settings [#with-the-other-settings]

| | `userAgent` | `proxy` |
|---|---|---|
| Attach mode | refused: it is your own Chrome, and turno does not change it | refused, for the same reason |
| Read mode | refused: Lightpanda presents its own user agent | refused: not checked with a proxy |
| Camoufox | refused: Firefox sends no client hints, and Camoufox presents its own values | works (WebRTC limited the same way) |
| Tab sharing, humanize | work | work |
| Natural language actions, live view, `turno-browser do` | work | work; the act model's prompt and the view's tab list hide the credentials like vault values |
| Recordings | work | flows and screenshots work; `record.traces` is refused with a proxy password, since a trace keeps the browser's launch options, password included |
| A server flag of its own (`--user-agent`, `--device`, `--proxy-server`) | refused: keep one | refused: keep one |

Each refusal comes when you set the key, or, for a server flag that clashes with the file, at
the first tool call, before any browser opens.