Skip to content

Shop25 pages + lab

Nginx Break-Fix Field Guide

502 Bad Gateway. 504 Gateway Time-out. 413 Request Entity Too Large. This tells you which side broke, what to run next, and what to change.

Every error.log line, curl result and timing came from a real nginx 1.27.5, broken on purpose.

$12Buy on GumroadCards, PayPal and UPI · lower price in India
Nginx Break-Fix Field Guide cover

What's inside

  • 9 flowcharts: 502, 504 and why it took longer than your timeout, 413 on upload, the SPA that 404s on refresh, redirect loops behind HTTPS, WebSockets that never upgrade, the wrong site answering, 403 on files that exist, the proxy_pass trailing slash
  • An error.log decoder: every line from the lab, what it means, where to go
  • Two tested templates: a reverse proxy and a single-page app
  • The lab: every config and script, plus the raw output

Found in the lab

  • A stopped backend gave 504 after 60 seconds, not a quick 502
  • nginx kept sending traffic to a dead container's old IP
  • A 3 s timeout with two upstreams made the user wait 6.02 s
  • 1,048,576 bytes uploaded fine. 1,048,577 got 413
  • The usual SPA fix served index.html for a missing JS file

Tested on

nginx 1.27.5, Node 22, curl 8.7.1, Docker Engine 29.9.2

For

Devs who put nginx in front of their app, juniors who inherited a server, anyone staring at a 502 with no idea which side broke.

Read first, free

Other guides