Skip to content

Debugging localhost Traffic

Traffic to 127.0.0.1/localhost is a special case: macOS’s system proxy setting (and most HTTP clients’ default proxy detection) excludes loopback addresses by convention, so simply starting TonyProxy usually isn’t enough to see a local server calling another local server.

Explicit proxy configuration

For a CLI tool or script, set the proxy explicitly rather than relying on system-wide settings:

Terminal window
export HTTP_PROXY=http://127.0.0.1:9090
export HTTPS_PROXY=http://127.0.0.1:9090
curl https://localhost:8443/api/health

Most HTTP clients (curl, Python requests, Node’s http) respect HTTP_PROXY/HTTPS_PROXY env vars even when they’d otherwise skip the system proxy for loopback addresses.

In code

For a client library configured programmatically, point its proxy setting at 127.0.0.1:9090 (or your configured port) directly rather than depending on it inheriting the system/environment proxy.

HTTPS to localhost

If the local server serves HTTPS with a self-signed or locally-trusted cert of its own, you’re now decrypting through two layers of custom certs — make sure TonyProxy’s CA is trusted (see HTTPS Certificate Setup) and that the client isn’t also pinning the local server’s original cert.