Skip to content

Transport: TLS, Proxy & Cookies

Every HTTP request Recon sends goes through one client, the wire engine. This page explains what that client does on the network: protocol choice, redirects, timeouts, timing phases, TLS, proxies and cookies. Read it when a request fails at the transport level, when you work behind a proxy or with a private CA, or when you need cookies to carry over between requests.

Trust a private CA, route traffic through a proxy except for localhost and .internal hosts, and keep cookies in a file between runs:

Terminal window
recon --format human --ca-cert certs/ca.pem \
--proxy http://127.0.0.1:4310 --no-proxy localhost,.internal \
--cookie-jar .recon/cookies.json \
send https://localhost:4311/setcookie
GET https://localhost:4311/setcookie 200 43.2ms 2B -> 2B (HTTP/1.1)
ok

Here the target is localhost, so the request bypasses the proxy, verifies the server against certs/ca.pem, and saves the cookies it receives to .recon/cookies.json.

The same settings can live in .recon/network.json so that you do not repeat them on every command. See The network.json file.

  • http:// URLs always use HTTP/1.1 over plain TCP. Recon does not attempt HTTP/2 without TLS.
  • https:// URLs offer ALPN h2 and http/1.1, in that order. If the server selects h2, the request uses HTTP/2. Otherwise it uses HTTP/1.1.
  • Any other URL scheme fails with unsupported URL scheme.

The negotiated protocol is reported as HTTP/1.1 or HTTP/2 in the protocol field of the result.

Each request opens a new connection. Recon does not pool or reuse connections between requests or redirect hops.

Recon adds these headers only when the request does not already set them (names compared case-insensitively):

Header Value
Host Host from the URL, plus :port when the URL has an explicit port. HTTP/1.1 only.
User-Agent recon/0.3.2
Accept-Encoding gzip, br, deflate

This is what a bare request looks like to a server that echoes headers back:

Terminal window
recon --format human send http://127.0.0.1:4310/echo
GET http://127.0.0.1:4310/echo 200 0.9ms 169B -> 169B (HTTP/1.1)
{
"method": "GET",
"path": "/echo",
"headers": {
"host": "127.0.0.1:4310",
"user-agent": "recon/0.3.2",
"accept-encoding": "gzip, br, deflate"
},
"body": ""
}

Recon reads the Content-Encoding response header and decodes the body:

Content-Encoding Decoder
gzip, x-gzip gzip
deflate deflate
br Brotli
absent or identity none
anything else none; the raw bytes are kept

If the header lists several encodings separated by commas, only the first one is decoded. A body that fails to decode is an error: failed to decode `<encoding>` response body: <message>.

The result reports both sizes: wire_bytes is the size received on the socket, and decoded_bytes is the size after decoding. The human summary line prints them as 50B -> 229B.

If the decoded body is not valid UTF-8, the text form of the body is replaced with <binary payload: N bytes>.

Redirects are followed automatically unless the request has the # @no-redirect directive. See .http Request Files.

  • Only status codes 301, 302, 303, 307 and 308 with a Location header are followed. The Location value is resolved against the current URL, so relative locations work.
  • The limit is 10 redirects per request. The next redirect after that fails with exceeded maximum redirects (10). The limit is fixed; no flag or setting changes it.
  • On 301, 302 and 303, a request whose method is not GET or HEAD is changed to GET and its body is dropped. Other headers, including Content-Type, are kept.
  • On 307 and 308, the method and body are kept.
  • When the next hop has a different origin (scheme, host or port), the Authorization header is removed. No other header is removed.
  • With the cookie jar on, Set-Cookie headers are captured on every hop, and each hop gets the cookies that match its own URL.
  • The Outbound Secret Firewall checks the request once, before the first hop. Redirect hops are not checked again. A tracked secret in a header other than Authorization, or in a body kept by a 307 or 308, is sent to the redirect target even when that host is outside the secret’s allowed_hosts. Use # @no-redirect on requests that carry such secrets to hosts you do not control.

A POST sent to a 301 arrives at the target as a GET with no body:

POST http://127.0.0.1:4310/echo 200 1.4ms 207B -> 207B (HTTP/1.1)
{
"method": "GET",
"path": "/echo",
"headers": {
"host": "127.0.0.1:4310",
"user-agent": "recon/0.3.2",
"accept-encoding": "gzip, br, deflate",
"content-type": "application/json"
},
"body": ""
}

The CLI summary line prints the method of the original request, not the method of the final hop.

Each followed hop is recorded with url, status, location and duration_ms. The POST /api/v1/send HTTP route returns these hops in its redirects array:

"redirects": [
{
"duration_ms": 45.240103,
"location": "https://localhost:4311/echo",
"status": 302,
"url": "https://localhost:4311/redirect/302"
}
]

Each request has one timeout that covers the whole exchange: DNS, connect, TLS, every redirect hop and the body download.

  • The default is 15000 ms.
  • Set it per request with # @timeout <ms> in a .http file (# @timeout 500 and # @timeout 500ms both work). There is no CLI flag and no workspace-wide setting.
  • Values below 100 ms are raised to 100 ms.

When the timeout expires, the request fails:

error E_CLI_RUNTIME: request timed out after 100ms
hint: Check workspace `.recon.toml`, arguments, or network connectivity.

That output came from a request with # @timeout 10, which Recon raised to 100 ms.

Every response carries a waterfall object with these fields, all in milliseconds:

Field What is measured
dns_ms Name resolution with the system resolver, for the target host (or for the proxy host when a proxy is used).
tcp_ms TCP connect. Recon tries each resolved address in order until one connects.
tls_ms TLS handshake. 0.0 for http://.
ttfb_ms From handing the request to the HTTP layer until the response headers arrive. This includes writing the request body.
download_ms Reading the complete body plus decompression.
total_ms Wall-clock time from the start of the first hop to the end of the final response.

The phase fields describe the final hop only. total_ms includes all redirect hops, so it can be larger than the sum of the phases. When a request goes through an HTTPS proxy tunnel, the CONNECT exchange is not part of any phase but is part of total_ms.

Terminal window
recon --format json --ca-cert ../certs/ca.pem send https://localhost:4311/echo
"waterfall": {
"dns_ms": 0.283812,
"download_ms": 0.019850000000000003,
"tcp_ms": 0.107861,
"tls_ms": 0.987749,
"total_ms": 42.050920999999995,
"ttfb_ms": 40.60488
},

Recon uses rustls with the ring crypto provider.

By default Recon trusts the Mozilla root set compiled into the binary (webpki-roots). It does not read the operating system trust store.

To trust a private or development CA, pass a PEM bundle with --ca-cert <PATH> or set ca_pem_path in .recon/network.json. The certificates in the file are added to the built-in roots; they do not replace them. A file with no certificates is rejected:

error E_CLI_RUNTIME: invalid transport configuration: TLS handshake failed with `<tls-config>`: custom CA PEM `../certs/san.ext` contained zero certificates

An untrusted server certificate fails the handshake:

error E_CLI_RUNTIME: TLS handshake failed with `localhost`: invalid peer certificate: UnknownIssuer

The SNI name is the host from the URL. IP address hosts are accepted.

-k / --insecure (or "insecure_skip_verify": true in network.json) turns off certificate verification completely: chain, expiry and host name. Handshake signatures are still checked. When this is on, a configured custom CA file is not read at all. Use it only for throwaway local servers.

Pass both --client-cert <PATH> and --client-key <PATH>, or set client_cert_pem_path and client_key_pem_path.

  • The certificate file is PEM. Every certificate in it is sent, so you can append intermediates after the leaf.
  • The key file is an unencrypted PEM private key. PKCS#8 (BEGIN PRIVATE KEY), PKCS#1 RSA (BEGIN RSA PRIVATE KEY) and SEC1 EC (BEGIN EC PRIVATE KEY) are read. Encrypted keys are not supported.
  • Giving only one of the two is an error.
error E_CLI_RUNTIME: invalid transport configuration: provide both `client_cert_pem_path` and `client_key_pem_path` for mTLS
error E_CLI_RUNTIME: invalid transport configuration: TLS handshake failed with `<tls-config>`: failed reading client key PEM `../certs/client-enc.key`: no items found

The second error is what an encrypted key (BEGIN ENCRYPTED PRIVATE KEY) produces.

Paths are used as given. A relative path is resolved against the directory you run Recon from, not the workspace root.

For https:// requests Recon records the TLS session and the server’s leaf certificate in a tls object:

Field Meaning
tls_version Negotiated version, for example TLSv1_3.
cipher_suite Negotiated suite, for example TLS13_AES_256_GCM_SHA384.
alpn h2 or http/1.1.
subject, issuer Distinguished names of the leaf certificate.
san_dns DNS names and IPv4 addresses from the Subject Alternative Name extension.
not_before, not_after Validity window, RFC 3339.
days_remaining Whole days until not_after; negative when expired.

The tls object is stored with the run in the Flight Recorder and returned by POST /api/v1/send under run.tls:

"tls": {
"alpn": "http/1.1",
"cipher_suite": "TLS13_AES_256_GCM_SHA384",
"days_remaining": 29,
"issuer": "CN=Recon Docs Test CA",
"not_after": "2026-12-30T15:47:41+00:00",
"not_before": "2026-11-30T15:47:41+00:00",
"san_dns": [
"localhost",
"127.0.0.1"
],
"subject": "CN=localhost",
"tls_version": "TLSv1_3"
}

Recon supports an HTTP proxy for http:// targets and CONNECT tunnelling for https:// targets. It does not read the HTTP_PROXY, HTTPS_PROXY or NO_PROXY environment variables. Configure proxies with --proxy or in network.json.

Target scheme Proxy used
http:// http_proxy
https:// https_proxy; if that is empty, http_proxy

--proxy <URL> sets both http_proxy and https_proxy to the same value.

The proxy URL has the form http://[user:password@]host[:port]. Without a port, the default port of the URL scheme is used (80 for http), or 8080 for an unknown scheme. Recon always speaks plain HTTP to the proxy itself; an https:// proxy URL does not make the connection to the proxy use TLS.

Recon connects to the proxy and sends the request with the full URL as the request target. The target host is not resolved locally.

Terminal window
recon --format human --proxy http://alice:s3cret@127.0.0.1:4310 send 'http://api.example.invalid/v1/ping?x=1'
GET http://api.example.invalid/v1/ping?x=1 200 0.7ms 258B -> 258B (HTTP/1.1)
{
"method": "GET",
"path": "http://api.example.invalid/v1/ping?x=1",
"headers": {
"host": "api.example.invalid",
"user-agent": "recon/0.3.2",
"accept-encoding": "gzip, br, deflate",
"proxy-authorization": "Basic YWxpY2U6czNjcmV0"
},
"body": ""
}

Recon sends CONNECT host:port HTTP/1.1 with Host, Proxy-Connection: keep-alive and, when the proxy URL has credentials, Proxy-Authorization. Any 2xx reply opens the tunnel; TLS to the target then runs inside it. Any other reply fails the request:

error E_CLI_RUNTIME: HTTP protocol error: proxy CONNECT rejected tunnel to api.example.invalid:443: `HTTP/1.1 407 Proxy Authentication Required`

Only Basic authentication is supported. It comes from the user and password in the proxy URL. Recon sends Proxy-Authorization: Basic base64(user:password), unless the request already sets its own Proxy-Authorization header (plain HTTP targets only).

A target host that matches any rule is contacted directly. Matching is case-insensitive.

Rule Matches
* Every host.
api.example.com That host, and any subdomain such as v2.api.example.com.
.example.com example.com and any subdomain. A leading dot makes no difference.
127.0.0.1:4310 That host on that port only.

--no-proxy takes a comma-separated list and can be repeated. Its rules are added to the rules in network.json.

The proxy, TLS and cookie settings apply to commands that use the wire client: send, twin, test, watch, flow, load, paginate, graphql, capsule reproduce, and auth oauth2-token / auth oauth2-login (for the token request). The sse, ws and grpc commands have their own transports and do not use these settings. The transport flags are global, so every command accepts them, but commands outside this list ignore them. recon ui also ignores them and reads network.json instead.

The cookie jar stores Set-Cookie values from responses and sends matching cookies on later requests.

Context Default
CLI, no .recon/network.json Off. Turn on with --cookies or --cookie-jar <PATH>.
CLI, .recon/network.json present Value of enable_cookies, which defaults to true when the field is missing.
recon ui Value of enable_cookies; on when there is no network.json.

The flags can only turn cookies on. To turn them off when network.json enables them, use --no-network-config.

  • In the CLI, the jar lives for one command. Requests inside that command share it, so later requests in a recon test run see cookies set by earlier ones. Without --cookie-jar, the jar is discarded when the command exits.
  • recon ui keeps one in-memory jar for the life of the server. It is shared across workspace switches and is never written to disk.

--cookie-jar <PATH> loads the file at start (if it exists) and writes the jar back after the requests finish. The parent directory is created when needed. The file is a JSON array:

Terminal window
recon --cookie-jar ../jar.json send http://127.0.0.1:4310/setcookie/a
[
{
"name": "session",
"value": "abc123",
"domain": "127.0.0.1",
"path": "/",
"secure": false,
"http_only": true,
"host_only": true
},
{
"name": "theme",
"value": "dark",
"domain": "127.0.0.1",
"path": "/",
"secure": false,
"http_only": false,
"expires_at_unix": 1796057321,
"host_only": true
}
]
Field Meaning
name, value Cookie name and value.
domain Lowercase host or domain, without a leading dot.
path Path prefix, starting with /.
secure Send only over https://.
http_only Stored from the HttpOnly attribute. It does not change sending.
expires_at_unix Expiry in Unix seconds. Omitted for session cookies.
host_only true when the cookie had no Domain attribute, so it matches only the exact host.

Session cookies (no expiry) are written to the file too, so they survive between commands. Expired cookies are dropped when the jar is listed or written. The next command then sends them:

GET http://127.0.0.1:4310/echo 200 0.6ms 211B -> 211B (HTTP/1.1)
{
"method": "GET",
"path": "/echo",
"headers": {
"host": "127.0.0.1:4310",
"user-agent": "recon/0.3.2",
"accept-encoding": "gzip, br, deflate",
"cookie": "session=abc123; theme=dark"
...
Attribute Behaviour
Domain Leading dot removed. The value must equal the request host or be a parent domain of it; otherwise the cookie is ignored. Without it, the cookie is host-only.
Path Used when it starts with /. Otherwise the default path is used: the request path up to its last / (or /).
Max-Age Seconds from now. 0 or a negative value deletes the cookie. Takes priority over Expires.
Expires Parsed as RFC 2822, %a, %d %b %Y %H:%M:%S GMT, %a, %d-%b-%Y %H:%M:%S GMT or %A, %d-%b-%y %H:%M:%S GMT. Unparseable dates are ignored. A date in the past deletes the cookie.
Secure The cookie is sent only to https:// URLs.
HttpOnly Recorded; no effect on sending.

SameSite and any other attribute are ignored. There is no public-suffix check. A new cookie replaces an existing one with the same name, domain and path. Cookies are not tied to a port.

  • A host-only cookie is sent only to its exact host. A domain cookie is sent to that domain and its subdomains.
  • The request path must equal the cookie path, or start with it at a / boundary.
  • Matching cookies are sorted by longest path first, then by name, and sent as one Cookie: a=1; b=2 header.
  • If the request already has a Cookie header, the jar adds nothing to that request.

.recon/network.json in the workspace root holds per-workspace transport defaults. The Web Studio writes it when you save network settings; you can also write it by hand. This file was saved through the settings API (the CA path is shortened):

{
"enable_cookies": true,
"proxy": {
"http_proxy": "http://user:pw@127.0.0.1:4399",
"https_proxy": null,
"no_proxy": [
"127.0.0.1",
"localhost"
]
},
"ca_pem_path": "/path/to/ca.pem",
"client_cert_pem_path": null,
"client_key_pem_path": null,
"insecure_skip_verify": false
}
Field Type Default Meaning
enable_cookies bool true Capture and send cookies.
proxy.http_proxy string or null null Proxy for http:// targets, and fallback for https://.
proxy.https_proxy string or null null CONNECT proxy for https:// targets.
proxy.no_proxy array of strings [] Bypass rules.
ca_pem_path string or null null Extra trusted CA PEM bundle.
client_cert_pem_path string or null null mTLS client certificate PEM.
client_key_pem_path string or null null mTLS client private key PEM.
insecure_skip_verify bool false Skip certificate verification.

Every field is optional. If the file is not valid JSON, Recon silently uses the defaults above.

  1. If --no-network-config is set, or the file does not exist, start from built-in defaults with cookies off. Otherwise start from the file.
  2. --proxy replaces both http_proxy and https_proxy.
  3. --no-proxy rules are appended (duplicates skipped).
  4. --ca-cert, --client-cert and --client-key replace the matching paths.
  5. --cookies or --cookie-jar turns cookies on.
  6. -k / --insecure turns verification off.

An invalid CA, certificate or key stops the command with invalid transport configuration: ... and exit code 2. In recon ui, an invalid network.json at start-up makes the server fall back to a client with default TLS and no proxy; saving invalid settings through the API is rejected with 400.

These flags are global, so they go before or after the subcommand.

Flag Value Effect
--proxy URL Proxy for both http:// and https:// targets.
--no-proxy list Bypass rules, comma-separated or repeated.
--ca-cert path Extra trusted CA PEM bundle.
--client-cert path mTLS client certificate PEM. Needs --client-key.
--client-key path mTLS client private key PEM. Needs --client-cert.
--cookies Turn on the in-memory cookie jar.
--cookie-jar path Load and save cookies as JSON at this path. Implies --cookies.
--no-network-config Ignore .recon/network.json.
-k, --insecure Skip TLS certificate verification.

Transport failures in the CLI print an E_CLI_RUNTIME error and exit with code 2.

Message Cause
invalid URL `<url>`: ... Bad URL, missing host, or a scheme other than http/https. Also used for a bad proxy URL (invalid proxy URL: ...).
DNS resolution failed for `<host>`: ... Lookup failed or returned no addresses.
TCP connection failed to `<addr>`: ... No resolved address accepted the connection. With a proxy, <addr> is the proxy.
TLS handshake failed with `<host>`: ... Handshake or certificate verification failed. <tls-config> as the host means the TLS settings themselves are invalid.
HTTP protocol error: ... Framing or connection error, including a rejected proxy CONNECT.
request timed out after <n>ms The request timeout expired.
failed to decode `<encoding>` response body: ... The body did not match its Content-Encoding.
exceeded maximum redirects (10) More than 10 redirects.

An mTLS server that rejects a missing client certificate can show up as HTTP protocol error: connection error rather than a TLS error.

  • Web Studio: the Network button in the top bar opens a dialog with Cookies, mTLS & CA and HTTP Proxy tabs. The command palette has Open Cookie Jar and Open mTLS & Proxy Settings.
  • HTTP API:
    • GET /api/v1/network/settings returns settings (proxy passwords masked as ***), cookies_count, mtls_configured, custom_ca_configured and insecure_tls_enabled.
    • POST /api/v1/network/settings validates the settings, writes .recon/network.json and swaps the live client. A proxy URL that still contains *** keeps the stored password when host, port and user are unchanged.
    • GET /api/v1/network/cookies lists the jar. POST adds a cookie (name, value, domain required; path defaults to /; secure, http_only optional; always host-only, no expiry). DELETE with domain and name query parameters (and optional path, default /) removes one cookie; DELETE without them clears the jar.
    • Mutating calls need the X-Recon-Token header. See HTTP API.