bitlvl
SR

HTTP statusni kodovi

Pretražite po broju ili reči. Poslednja kolona je situacija koja obično proizvodi kod, što je ono što vam treba kada buljite u jedan takav u logu. Tabela je na engleskom.

 
 
KodNazivZnačenjeKada ga vidite
100Continue
Informativni
The server has received the headers; send the body.After Expect: 100-continue, before uploading a large body.
101Switching Protocols
Informativni
The server agrees to change protocol.WebSocket handshake.
102Processing
Informativni
WebDAV: request accepted, still working.
103Early Hints
Informativni
Preliminary headers, mainly Link: rel=preload, before the final response.CDNs and Cloudflare to start loading assets early.
200OK
Uspeh
The request succeeded.The normal case.
201Created
Uspeh
A new resource was created; Location header points to it.POST to a collection in a REST API.
202Accepted
Uspeh
Accepted for processing, not finished.Async jobs and queues.
203Non-Authoritative Information
Uspeh
Response modified by a proxy.Rare.
204No Content
Uspeh
Success with nothing to return.DELETE, PUT, beacon endpoints, preflight responses.
205Reset Content
Uspeh
Success; the client should reset the form.Rare.
206Partial Content
Uspeh
Only the requested byte range is returned.Video streaming, resumable downloads (Range header).
207Multi-Status
Uspeh
WebDAV: multiple status codes in an XML body.
226IM Used
Uspeh
Delta encoding applied.Rare.
300Multiple Choices
Preusmerenje
Several representations are available.Rare.
301Moved Permanently
Preusmerenje
The resource has a new permanent URL; the browser caches the redirect. Method may change to GET.http→https, old URLs, www canonicalisation. Transfers SEO ranking.
302Found
Preusmerenje
Temporary redirect; method may change to GET.Post-login redirects, A/B tests. Not cached by default.
303See Other
Preusmerenje
Redirect to a different resource with GET.After a POST (post/redirect/get pattern).
304Not Modified
Preusmerenje
The cached copy is still valid; no body.Conditional requests with If-None-Match / If-Modified-Since.
307Temporary Redirect
Preusmerenje
Like 302 but the method and body must not change.Redirecting a POST without turning it into a GET; HSTS internal redirects in Chrome.
308Permanent Redirect
Preusmerenje
Like 301 but the method and body must not change.Permanent redirects of API endpoints.
400Bad Request
Greška klijenta
The request is malformed; the server will not process it.Invalid JSON, bad parameters, oversized headers, invalid Host.
401Unauthorized
Greška klijenta
Authentication is required or failed. The response should say how (WWW-Authenticate).Missing or expired token. (Should have been called Unauthenticated.)
402Payment Required
Greška klijenta
Reserved; used by some APIs for quota or billing problems.Stripe, some SaaS APIs, Cloudflare for some plan limits.
403Forbidden
Greška klijenta
Authenticated (or not) but not allowed.Permission denied, WAF block, directory listing disabled, Cloudflare challenges.
404Not Found
Greška klijenta
No resource at this URL.Typos, deleted pages, wrong routes. Should return a helpful page.
405Method Not Allowed
Greška klijenta
The URL exists but not for this method; Allow header lists the valid ones.POST to a static file, GET on a webhook endpoint.
406Not Acceptable
Greška klijenta
No representation matches the Accept headers.Rare; strict content negotiation.
407Proxy Authentication Required
Greška klijenta
Authenticate with the proxy first.Corporate proxies.
408Request Timeout
Greška klijenta
The server gave up waiting for the request.Slow clients; browsers retry silently.
409Conflict
Greška klijenta
The request conflicts with the current state.Duplicate create, version mismatch, edit collisions.
410Gone
Greška klijenta
Permanently removed, and the server knows it.Tells search engines to drop the URL faster than 404.
411Length Required
Greška klijenta
Content-Length header missing.Some servers for chunked uploads.
412Precondition Failed
Greška klijenta
An If-* condition failed.Optimistic concurrency with ETags (If-Match).
413Content Too Large
Greška klijenta
Body exceeds the limit.nginx client_max_body_size, upload limits.
414URI Too Long
Greška klijenta
The URL exceeds the limit (typically 8 KB).Huge GET query strings; use POST.
415Unsupported Media Type
Greška klijenta
The Content-Type is not supported.Sending form data where JSON is expected.
416Range Not Satisfiable
Greška klijenta
The Range header is outside the file.Broken resumable downloads.
417Expectation Failed
Greška klijenta
The Expect header cannot be met.Old proxies with Expect: 100-continue.
418I'm a teapot
Greška klijenta
April Fools RFC 2324.Easter eggs; some sites use it to reject bots.
421Misdirected Request
Greška klijenta
Sent to a server that cannot produce a response for this host.HTTP/2 connection reuse across hostnames with the wrong certificate.
422Unprocessable Content
Greška klijenta
Syntactically valid but semantically wrong.Validation errors in REST APIs (Rails, Laravel, GitHub).
423Locked
Greška klijenta
WebDAV: resource is locked.
424Failed Dependency
Greška klijenta
WebDAV: a previous request failed.
425Too Early
Greška klijenta
The server will not process a request that might be replayed (TLS 1.3 0-RTT).
426Upgrade Required
Greška klijenta
Switch to a different protocol.Forcing TLS or HTTP/2.
428Precondition Required
Greška klijenta
The request must be conditional.APIs enforcing If-Match to prevent lost updates.
429Too Many Requests
Greška klijenta
Rate limit hit; Retry-After says when to try again.API throttling, login brute-force protection, Cloudflare rate limiting.
431Request Header Fields Too Large
Greška klijenta
Headers exceed the limit.Huge cookies.
451Unavailable For Legal Reasons
Greška klijenta
Blocked by a legal demand.Geo-blocking for GDPR, court orders.
500Internal Server Error
Greška servera
The server hit an unexpected error.Uncaught exceptions, misconfiguration. Check the server logs, not the browser.
501Not Implemented
Greška servera
The server does not support the method.Rare; PATCH on old servers.
502Bad Gateway
Greška servera
A proxy got an invalid response from the upstream.App server crashed or not listening; nginx/HAProxy/Cloudflare in front of a dead backend.
503Service Unavailable
Greška servera
Temporarily unable to handle the request.Maintenance, overload, all backends down. Send Retry-After.
504Gateway Timeout
Greška servera
The upstream did not answer in time.Slow backend behind a proxy (proxy_read_timeout, Cloudflare’s 100 s limit).
505HTTP Version Not Supported
Greška servera
The HTTP version is not supported.Rare.
507Insufficient Storage
Greška servera
WebDAV: out of space.
508Loop Detected
Greška servera
WebDAV: infinite loop.
510Not Extended
Greška servera
Further extensions required.Rare.
511Network Authentication Required
Greška servera
Log in to the network first.Captive portals in hotels and airports.
520Cloudflare: Unknown Error
Cloudflare
The origin returned something Cloudflare could not interpret (empty reply, invalid headers, > 16 KB headers).Origin resets the connection or sends garbage.
521Cloudflare: Web Server Is Down
Cloudflare
Cloudflare could not connect to the origin on the port.Origin firewall blocking Cloudflare IPs, web server stopped.
522Cloudflare: Connection Timed Out
Cloudflare
TCP handshake with the origin timed out.Origin overloaded or unreachable, wrong DNS IP.
523Cloudflare: Origin Is Unreachable
Cloudflare
No route to the origin.Wrong IP in DNS, origin network down.
524Cloudflare: A Timeout Occurred
Cloudflare
TCP connected but the origin did not send a response within 100 seconds.Slow scripts, long reports, big uploads; move the work async.
525Cloudflare: SSL Handshake Failed
Cloudflare
TLS handshake with the origin failed.Full (strict) mode without a valid origin certificate, cipher mismatch.
526Cloudflare: Invalid SSL Certificate
Cloudflare
Origin certificate not trusted (Full strict).Self-signed origin cert; use a Cloudflare Origin Certificate.
530Cloudflare: Origin DNS Error / 1xxx
Cloudflare
Returned with a 1xxx error code in the body.Tunnel down, DNS error, bans.

Rezultati i poruke ovog alata prikazuju se na engleskom.

Pet klasa

1xx informativni, retko se vide van nadogradnji protokola. 2xx uspeh. 3xx preusmerenje: klijent mora da traži drugde. 4xx klijent je uradio nešto pogrešno (ili nema dozvolu). 5xx server je zakazao. Pregledač ili klijent koji naiđe na nepoznat kod tretira ga kao x00 njegove klase, pa se novi kodovi elegantno degradiraju.

Parovi koji se mešaju

  • 301 naspram 302 naspram 307/308: 301 i 308 su trajni (keširaju se, a pretraživači premeštaju rangiranje); 302 i 307 su privremeni. Varijante 7/8 zabranjuju promenu metode, pa POST ostaje POST; 301/302 dozvoljavaju pregledaču da ga pretvori u GET. Koristite 308 za trajna premeštanja API-ja, 301 za veb stranice, 303 posle POST-a forme.
  • 401 naspram 403: 401 znači „ko ste vi?“ (nedostajući ili pogrešni kredencijali; ponovite sa autentifikacijom). 403 znači „znam ko ste i odgovor je ne“. Vraćanje 404 umesto 403 je legitimno kada ne želite da otkrijete da resurs postoji.
  • 502 naspram 503 naspram 504: svi dolaze od proksija ispred vaše aplikacije. 502: bekend je odgovorio smećem ili zatvorio konekciju (pao, pogrešan port). 503: ništa nije dostupno (održavanje, svi bekendi nedostupni, preopterećenje). 504: bekendu je trebalo predugo. Cloudflare 52x kodovi ih dodatno preciziraju.
  • 400 naspram 422: 400 za zahtev koji server uopšte ne može da parsira; 422 za onaj koji je parsirao, ali odbija pri validaciji. Mnogi API-ji koriste 400 za oba.

Cloudflare 52x

Cloudflare dodaje sopstvene kodove za probleme između svog edge-a i vašeg origin servera. 521 znači da nije mogao da otvori TCP konekciju (firewall, server ugašen), 522 da je konekcija istekla (pogrešna IP adresa, preopterećenje), 524 da je konekcija uspela, ali origin nije odgovorio u roku od 100 sekundi, 525/526 TLS problemi sa sertifikatom origin servera (pređite na Full strict sa Origin sertifikatom, ili na Flexible). Uvek ukazuju na vaš server ili put do njega, nikad na posetioca.

Pitanja

Koja je razlika između 404 i 410?

404 kaže da ovde sada nema ničega; 410 kaže da je bilo i da je namerno uklonjeno. Pretraživači brže izbacuju 410 URL. Koristite 410 za obrisan sadržaj koji nećete vratiti.

Da li API treba da vraća 200 sa greškom u telu?

Ne. Klijenti, proksiji, keševi i monitoring svi se oslanjaju na statusni kod. Koristite 4xx za greške klijenta i 5xx za greške servera, sa detaljima u telu (RFC 9457 problem+json je standardni oblik).

Zašto dobijam 502 od nginx-a?

nginx nije mogao da dobije ispravan odgovor od upstream-a: aplikacija ne radi, sluša na drugom portu ili socketu, pala je usred zahteva, ili je poslala zaglavlja koja je nginx odbio. Proverite logove aplikacije i error log nginx-a, a ne pregledač.

Šta znači 429 i šta treba da uradim?

Previše zahteva: dostigli ste ograničenje učestalosti. Sačekajte vreme iz zaglavlja Retry-After, pa pokušajte ponovo uz backoff. Za API-je, rasporedite pozive ili zatražite veću kvotu.