Topic cluster

Troubleshooting proxies

Read 502, 503 and 504 correctly, drive curl through a proxy, understand no_proxy, survive a corporate proxy, and bisect a chain methodically.

33 guides · cluster reviewed 5 November 2026

Most proxy debugging goes wrong in the first minute, because the investigation starts at the layer that reported the error rather than the layer that caused it. A proxy reports what it experienced, which is usually a symptom of something one hop further in.

The method that works is always the same: draw the chain, bisect it, and find the innermost hop that still shows the fault. A proxy debugging playbook is the long form of that method, and everything else in this cluster is a specific case of it.

By symptom#

SymptomStart here
502, 503 or 504502 vs 503 vs 504
Intermittent 502 under loadKeep-alive and upstream connection pooling
504 with no upstream log lineTimeout budgets
499 in the nginx access log, ALB 460, Envoy DCWhat nginx 499 means, and its HAProxy, Envoy and ALB names
connect() failed (111) to [::1] with proxy_pass http://localhostWhy nginx tries ::1 when proxy_pass says localhost
SSL_do_handshake() failed ... while SSL handshaking to upstream, or upstream SSL certificate verify errorWhy nginx fails the TLS handshake to an HTTPS upstream
connect() to 127.0.0.1:3000 failed (13: Permission denied) while connecting to upstream on RHEL, Rocky, Alma or FedoraWhy nginx gets 13: Permission denied connecting to upstream (SELinux)
connect() failed (111) to 127.0.0.1, or host not found in upstream "host.docker.internal", from nginx in a containerWhy nginx in Docker returns 502 for proxy_pass localhost
502 Bad Gateway from Nginx Proxy Manager, or could not be resolved (3: Host not found) in /data/logs/proxy-host-*_error.logWhy Nginx Proxy Manager shows 502 Bad Gateway for a proxy host
Caddy 502 with dial tcp ... connect: connection refused, no such host, i/o timeout or tls: first record does not look like a TLS handshakeWhy Caddy reverse_proxy returns 502 with dial tcp: connection refused
Envoy or Istio 503 with upstream connect error or disconnect/reset before headers. reset reason: connection termination, or flag UCWhat reset reason: connection termination means in Envoy and Istio
Apache AH01102: error reading status line from remote server, AH00898: Error reading from remote server, or 502 Proxy Error now and thenWhy Apache logs AH01102: error reading status line from remote server
HAProxy 503 No server is available to handle this request, <NOSRV> in the log, or backend 'X' has no server available!Why HAProxy returns 503 No server is available to handle this request
HAProxy Server X is DOWN, reason: Layer4 connection problem, Layer4 timeout, Layer6 invalid response or Layer7 wrong statusHAProxy health check failed: what each Layer4, Layer6 and Layer7 reason means
502 after restarting a Docker containernginx 502 after a Docker container restart
worker_connections are not enough, or Too many open filesWhat worker_connections should be on a reverse proxy
Access-Control-Allow-Origin contains multiple valuesWhy the CORS header appears twice behind a proxy
Large downloads stop early: ERR_CONTENT_LENGTH_MISMATCH, curl error 18Why nginx cuts off large downloads
upstream sent no valid HTTP/1.0 header, status 009, or Received HTTP/0.9 when not allowedWhy nginx logs no valid HTTP/1.0 header
A POST arrives as a GET, or with an empty body, after a 301 or 302 redirectWhy a POST becomes a GET after a redirect behind nginx
400 The plain HTTP request was sent to HTTPS port, or error_page 497 not redirectingWhy nginx says the plain HTTP request was sent to HTTPS port
A custom header such as X_Api_Key never reaches the backend, or client sent invalid header lineWhy nginx drops request headers with underscores
Uploads through Traefik fail at exactly 60 seconds with 499, 502 or 504Why large uploads through Traefik fail after 60 seconds
413 Request Entity Too Large, or client intended to send too large body after raising client_max_body_sizeWhy nginx returns 413 Request Entity Too Large
X-Cache-Status: MISS on every request, or an empty $upstream_cache_statusWhy is nginx proxy_cache always MISS?
upstream sent too big headerHeader and body size limits
Wrong client IP in the logsConfiguring trusted proxies
Infinite redirect loop over HTTPSX-Real-IP, X-Forwarded-Proto, Host and Port
404 only for one path prefixnginx proxy_pass and the trailing slash
Some tools bypass the proxy, others do notThe no_proxy environment variable
unable to get local issuer certificateTLS interception and corporate root CAs
npm, pip, git or docker failing at workCorporate proxies and developer tooling
Squid logs TCP_DENIED/403 for every request, or X-Squid-Error: ERR_ACCESS_DENIED 0Why does Squid log TCP_DENIED/403 for every request?
ERR_TUNNEL_CONNECTION_FAILED, ERR_PROXY_CONNECTION_FAILED or ERR_PROXY_AUTH_UNSUPPORTED in Chrome or EdgeWhat ERR_TUNNEL_CONNECTION_FAILED means, and what the proxy answered
wrong version number or Your proxy appears to only use HTTP through a proxyShould HTTPS_PROXY start with http:// or https://?
407 from every dev tool behind an NTLM or Kerberos proxyCntlm or Px: which local auth proxy to use
Windows proxy set in Settings, a service or tool still goes directnetsh winhttp vs Windows proxy settings

The one tool to learn properly#

curl through a proxy is worth reading even if you already use curl daily. The --write-out timing breakdown alone will localise most latency problems to a single hop in one command.

Every guide in this cluster#