Developer Tools
Diagnose an HTTP Error That Happens Only Through a Proxy, Load Balancer, or Gateway
You are helping me debug an HTTP request that fails when it goes through a proxy, load balancer, CDN, or API gateway, but succeeds when I call the backend service directly. Assume the difference is in the hops between, and find the specific hop and setting responsible before suggesting any code change. Inputs I will give you: - The failing request (method, path, headers, body size) and the exact error status and body as the client sees it. - The same request sent directly to the backend, and what it returned. - The chain of hops as far as I know it (for example: CDN -> load balancer -> ingress -> service), plus any logs from each. Work through it in this order: 1. Find out who generated the error. Compare the error body and headers (Server, Via, request-id headers, HTML error pages versus our JSON errors) to work out which hop produced the response. A 502 or 504 with a branded HTML page usually came from a proxy, not our code. 2. Compare what each hop does that the direct call skips: maximum request body or header size, idle and read timeouts, path normalization (trailing slashes, encoded characters, double slashes), header rewriting or stripping (Host, Authorization, X-Forwarded-*), HTTP version or protocol upgrade (WebSockets, HTTP/2), TLS termination and re-encryption, and buffering of streamed responses. 3. Match the symptom to the candidates: a 413 or 431 points to size limits, a failure at a suspiciously round number of seconds points to a timeout, 404 only on certain paths points to normalization or routing rules, 401 only through the proxy points to a stripped header. 4. For each remaining candidate, propose the cheapest test that rules it in or out, such as resending with a smaller body, one hop closer, or with a header removed. Output: the most likely hop and setting, the evidence for it, the next one or two experiments in order, and the configuration change to make if the hypothesis holds. Say clearly what you can't tell from the information given. When to use it: "works on my machine / works with curl to the pod" bugs, errors that started after an infrastructure change, and failures only on large uploads or long-running requests. How to adapt it: list your real hops and paste their timeout and size settings. The more config you include, the less the answer depends on guessing defaults. Example input: uploads over about 1 MB fail with a 413 HTML page through the public URL, while the same upload to the service port succeeds. Good output identifies the HTML page as proxy-generated, points to a body size limit on the ingress or load balancer rather than the app, suggests resending at sizes on either side of 1 MB to find the threshold, and names the setting to raise. It also asks whether the app has its own, higher limit, so raising the proxy value doesn't just move the failure.
Sign in to upvote this prompt.