Send a form with POST to an address that answers 301 Moved Permanently, and the follow-up request arrives at the new address as a GET with no body. The form data is gone. Change the redirect to a 308 and the data survives. That single difference has broken more form submissions than most bugs, and it sits in a three-digit number most people only glance at. Every status code below was produced by a real nginx 1.24 server and a small Python application set up for testing, and checked with curl.
Five classes, one first digit
The first digit carries the meaning
Every HTTP response starts with a three-digit status code, and the first digit sorts it into a class. RFC 9110, the current specification for HTTP semantics, defines them; two of its one-line descriptions sum up the split most people care about. The 4xx class means the client seems to have erred. The 5xx class means the server is aware that it has erred.
| Class | Meaning | Common examples |
|---|---|---|
| 1xx | Informational | 101 Switching Protocols |
| 2xx | Success | 200 OK, 201 Created, 204 No Content |
| 3xx | Redirection | 301, 302, 304, 307, 308 |
| 4xx | Client error | 400, 401, 403, 404, 405, 429 |
| 5xx | Server error | 500, 502, 503, 504 |
The reason phrase is decoration
The words after the number, such as “OK” or “Moved Temporarily,” are for humans. Software is expected to act on the number. nginx, for example, labels its 302 responses “Moved Temporarily,” an older wording, while the specification’s name is “Found.” Both mean the same thing to every client.
Why the class matters more than the number
A program that sees an unfamiliar code can still act sensibly on its first digit: retry a 5xx later, fix the request after a 4xx, follow a 3xx. When troubleshooting, the class says which side to look at. A 4xx points at the request; a 5xx points at the server or something behind it.

Redirects: the POST trap
301 and 302 may turn POST into GET
The test server had four addresses, each redirecting to an echo endpoint with a different code. curl sent a small POST body to each, with -L to follow the redirect:
| Redirect | What arrived at the new address |
|---|---|
| 301 Moved Permanently | GET, no body |
| 302 Found | GET, no body |
| 307 Temporary Redirect | POST, body intact |
| 308 Permanent Redirect | POST, body intact |
RFC 9110 explains the first two rows. For both 301 and 302, it says that for historical reasons a user agent may change the request method from POST to GET. Browsers and curl do exactly that. For 307, the specification says the method must not change on automatic redirection, and for 301 it suggests 308 as the replacement when the method switch is unwanted.
Choosing between them
| Situation | Code |
|---|---|
| Page moved for good, ordinary links | 301 |
| Temporary detour for page views | 302 |
| Temporary redirect of an API or form endpoint | 307 |
| Permanent move of an API or form endpoint | 308 |
Search engines treat permanent redirects as a signal to update their index; browsers may cache them. A 301 sent by mistake can stick in visitors’ browsers long after the configuration is fixed.
304 is a redirect in name only
304 Not Modified lives in the 3xx class but redirects nowhere. It answers a conditional request with “the copy already held is still good,” and carries no body. It is the response that makes caching cheap.
400, 401, 403, 404 and 405
400 Bad Request
nginx returned 400 when a request arrived with no Host header, both from curl and from a hand-typed GET / HTTP/1.1 with nothing after it. HTTP/1.1 requires that header. A 400 means the server couldn’t make sense of the request itself.
401 vs 403
These two get confused constantly:
- 401 Unauthorized means “authenticate first.” RFC 9110 requires a server sending 401 to include a
WWW-Authenticateheader saying how. nginx returned 401 for a location protected with basic authentication. Despite its name, 401 is about identity. - 403 Forbidden means the server understood the request and refuses it. In the test, a file with no read permissions on disk returned 403. Logging in won’t help a 403; the answer is no for this requester.
404 and 405
404 is the familiar “nothing here.” 405 Method Not Allowed is subtler: the resource exists but doesn’t accept that method. A DELETE sent to a static page returned 405, and so did a made-up BREW method. RFC 9110 says a 405 response must include an Allow header listing the methods that are accepted, which is a useful clue when an API call fails.

429 vs 503: rate limits have a default problem
What 429 is for
MDN’s page on 429 defines it as the client having sent too many requests in a given amount of time, the mechanism commonly called rate limiting. A Retry-After header may say how long to wait.
nginx says 503 unless told otherwise
The test zone allowed one request per second. Three requests in a row returned:
200
503
503
The nginx limit_req documentation shows why: limit_req_status defaults to 503. Adding limit_req_status 429; changed the same test to 200, 429, 429. The difference matters. A 503 tells clients and monitoring that the server is unavailable, which can trigger alerts and retries that make the overload worse. A 429 tells the caller it is the one sending too much.
The test that didn’t limit anything
The first version of the rate-limited location used nginx’s return directive to send its reply. Every request came back 200, no matter how fast. nginx processes return in an earlier stage of request handling than limit_req, so the response went out before the rate limit was ever consulted. Swapping return for a real file made the limit work. A rate limit that has never been seen returning 429 or 503 in a test has never been shown to work.
500, 502, 503, 504: whose fault is it
500 Internal Server Error
The application itself failed. A tiny Python app built to always return 500 did exactly that. In real systems, a 500 usually means an unhandled error in the code, and the application’s logs hold the answer.
502 Bad Gateway
RFC 9110 defines 502 as a gateway or proxy receiving an invalid response from the server behind it. The test produced it two ways:
- nginx proxying to a port where nothing was listening.
- nginx proxying to a Python app that crashed in the middle of a request and closed the connection without answering.
The second case is worth remembering. The application did fail, but the visitor saw 502, not 500, because the proxy never received a proper response to pass along.
503 and 504
503 Service Unavailable means the server can’t handle the request right now, often during overload or maintenance, and nginx also uses it for rate limiting by default, as above. 504 Gateway Timeout means the proxy gave up waiting. The test set nginx’s proxy_read_timeout to 2 seconds in front of an endpoint that took 5, and the result was 504.
| Code | Where to look first |
|---|---|
| 500 | The application’s own error log |
| 502 | Is the backend running? Did it crash mid-request? Right port? |
| 503 | Overload, maintenance mode, or a rate limit |
| 504 | Backend too slow, or the proxy’s timeout too short |

Reading status codes from the command line
Quick checks with curl
curl -sI https://example.com/prints the status line and headers.curl -s -o /dev/null -w '%{http_code}\n' URLprints only the code, handy in scripts.curl -sIL URLfollows every redirect and shows each hop’s status, which exposes redirect chains and loops.curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' URLshows where a redirect points without following it.
When the code lies
Status codes are chosen by whoever wrote the server or application, and some choose badly. Single-page apps often return 200 for every address and draw a “not found” message in the page, which hides missing pages from search engines and monitors. Some APIs return 200 with an error inside the body. Load balancers can turn an application’s 500 into a 502, as the test showed. The code is the server’s own account of what happened, and like any account, it is worth checking against the logs.
A short list worth memorizing
200 worked. 301 and 308 moved for good, 302 and 307 for now, and the 30x pair that keeps POST intact is the one ending in 7 or 8. 401 means log in, 403 means no. 429 means slow down. 502 means the thing behind the proxy didn’t answer properly, and 504 means it didn’t answer in time.
Sources
- RFC 9110, HTTP Semantics (Section 15, Status Codes), RFC Editor: https://www.rfc-editor.org/rfc/rfc9110.html
- 429 Too Many Requests, MDN Web Docs: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/429
- Module ngx_http_limit_req_module, nginx documentation: https://nginx.org/en/docs/http/ngx_http_limit_req_module.html
