bitlvl
ES

Códigos de estado HTTP

Busca por número o palabra. La última columna es la situación que suele producir el código, que es lo que necesitas cuando lo tienes delante en un registro. La tabla está en inglés.

 
 
CódigoNombreSignificadoCuándo lo ves
100Continue
Informativo
The server has received the headers; send the body.After Expect: 100-continue, before uploading a large body.
101Switching Protocols
Informativo
The server agrees to change protocol.WebSocket handshake.
102Processing
Informativo
WebDAV: request accepted, still working.
103Early Hints
Informativo
Preliminary headers, mainly Link: rel=preload, before the final response.CDNs and Cloudflare to start loading assets early.
200OK
Éxito
The request succeeded.The normal case.
201Created
Éxito
A new resource was created; Location header points to it.POST to a collection in a REST API.
202Accepted
Éxito
Accepted for processing, not finished.Async jobs and queues.
203Non-Authoritative Information
Éxito
Response modified by a proxy.Rare.
204No Content
Éxito
Success with nothing to return.DELETE, PUT, beacon endpoints, preflight responses.
205Reset Content
Éxito
Success; the client should reset the form.Rare.
206Partial Content
Éxito
Only the requested byte range is returned.Video streaming, resumable downloads (Range header).
207Multi-Status
Éxito
WebDAV: multiple status codes in an XML body.
226IM Used
Éxito
Delta encoding applied.Rare.
300Multiple Choices
Redirección
Several representations are available.Rare.
301Moved Permanently
Redirección
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
Redirección
Temporary redirect; method may change to GET.Post-login redirects, A/B tests. Not cached by default.
303See Other
Redirección
Redirect to a different resource with GET.After a POST (post/redirect/get pattern).
304Not Modified
Redirección
The cached copy is still valid; no body.Conditional requests with If-None-Match / If-Modified-Since.
307Temporary Redirect
Redirección
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
Redirección
Like 301 but the method and body must not change.Permanent redirects of API endpoints.
400Bad Request
Error del cliente
The request is malformed; the server will not process it.Invalid JSON, bad parameters, oversized headers, invalid Host.
401Unauthorized
Error del cliente
Authentication is required or failed. The response should say how (WWW-Authenticate).Missing or expired token. (Should have been called Unauthenticated.)
402Payment Required
Error del cliente
Reserved; used by some APIs for quota or billing problems.Stripe, some SaaS APIs, Cloudflare for some plan limits.
403Forbidden
Error del cliente
Authenticated (or not) but not allowed.Permission denied, WAF block, directory listing disabled, Cloudflare challenges.
404Not Found
Error del cliente
No resource at this URL.Typos, deleted pages, wrong routes. Should return a helpful page.
405Method Not Allowed
Error del cliente
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
Error del cliente
No representation matches the Accept headers.Rare; strict content negotiation.
407Proxy Authentication Required
Error del cliente
Authenticate with the proxy first.Corporate proxies.
408Request Timeout
Error del cliente
The server gave up waiting for the request.Slow clients; browsers retry silently.
409Conflict
Error del cliente
The request conflicts with the current state.Duplicate create, version mismatch, edit collisions.
410Gone
Error del cliente
Permanently removed, and the server knows it.Tells search engines to drop the URL faster than 404.
411Length Required
Error del cliente
Content-Length header missing.Some servers for chunked uploads.
412Precondition Failed
Error del cliente
An If-* condition failed.Optimistic concurrency with ETags (If-Match).
413Content Too Large
Error del cliente
Body exceeds the limit.nginx client_max_body_size, upload limits.
414URI Too Long
Error del cliente
The URL exceeds the limit (typically 8 KB).Huge GET query strings; use POST.
415Unsupported Media Type
Error del cliente
The Content-Type is not supported.Sending form data where JSON is expected.
416Range Not Satisfiable
Error del cliente
The Range header is outside the file.Broken resumable downloads.
417Expectation Failed
Error del cliente
The Expect header cannot be met.Old proxies with Expect: 100-continue.
418I'm a teapot
Error del cliente
April Fools RFC 2324.Easter eggs; some sites use it to reject bots.
421Misdirected Request
Error del cliente
Sent to a server that cannot produce a response for this host.HTTP/2 connection reuse across hostnames with the wrong certificate.
422Unprocessable Content
Error del cliente
Syntactically valid but semantically wrong.Validation errors in REST APIs (Rails, Laravel, GitHub).
423Locked
Error del cliente
WebDAV: resource is locked.
424Failed Dependency
Error del cliente
WebDAV: a previous request failed.
425Too Early
Error del cliente
The server will not process a request that might be replayed (TLS 1.3 0-RTT).
426Upgrade Required
Error del cliente
Switch to a different protocol.Forcing TLS or HTTP/2.
428Precondition Required
Error del cliente
The request must be conditional.APIs enforcing If-Match to prevent lost updates.
429Too Many Requests
Error del cliente
Rate limit hit; Retry-After says when to try again.API throttling, login brute-force protection, Cloudflare rate limiting.
431Request Header Fields Too Large
Error del cliente
Headers exceed the limit.Huge cookies.
451Unavailable For Legal Reasons
Error del cliente
Blocked by a legal demand.Geo-blocking for GDPR, court orders.
500Internal Server Error
Error del servidor
The server hit an unexpected error.Uncaught exceptions, misconfiguration. Check the server logs, not the browser.
501Not Implemented
Error del servidor
The server does not support the method.Rare; PATCH on old servers.
502Bad Gateway
Error del servidor
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
Error del servidor
Temporarily unable to handle the request.Maintenance, overload, all backends down. Send Retry-After.
504Gateway Timeout
Error del servidor
The upstream did not answer in time.Slow backend behind a proxy (proxy_read_timeout, Cloudflare’s 100 s limit).
505HTTP Version Not Supported
Error del servidor
The HTTP version is not supported.Rare.
507Insufficient Storage
Error del servidor
WebDAV: out of space.
508Loop Detected
Error del servidor
WebDAV: infinite loop.
510Not Extended
Error del servidor
Further extensions required.Rare.
511Network Authentication Required
Error del servidor
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.

Los resultados y mensajes de esta herramienta se muestran en inglés.

Las cinco clases

1xx informativos, rara vez vistos fuera de las actualizaciones de protocolo. 2xx éxito. 3xx redirección: el cliente debe buscar en otro sitio. 4xx el cliente hizo algo mal (o no está autorizado). 5xx el servidor falló. Un navegador o cliente que encuentra un código desconocido lo trata como el x00 de su clase, así que los códigos nuevos degradan con elegancia.

Pares que se confunden

  • 301 vs 302 vs 307/308: 301 y 308 son permanentes (se cachean, y los buscadores trasladan el posicionamiento); 302 y 307 son temporales. Las variantes 7/8 prohíben cambiar el método, así que un POST sigue siendo un POST; 301/302 dejan que el navegador lo convierta en GET. Usa 308 para traslados permanentes de API, 301 para páginas web, 303 tras un POST de formulario.
  • 401 vs 403: 401 significa «¿quién eres?» (credenciales ausentes o incorrectas; reintenta con autenticación). 403 significa «sé quién eres y la respuesta es no». Devolver 404 en vez de 403 es legítimo cuando no quieres revelar que el recurso existe.
  • 502 vs 503 vs 504: todos vienen de un proxy delante de tu aplicación. 502: el backend respondió con basura o cerró la conexión (se cayó, puerto equivocado). 503: nada disponible (mantenimiento, todos los backends caídos, sobrecarga). 504: el backend tardó demasiado. Los códigos 52x de Cloudflare los afinan más.
  • 400 vs 422: 400 para una petición que el servidor no puede analizar en absoluto; 422 para una que analizó pero rechaza en la validación. Muchas API usan 400 para ambos.

Cloudflare 52x

Cloudflare añade sus propios códigos para problemas entre su borde y tu origen. 521 significa que no pudo abrir una conexión TCP (cortafuegos, servidor caído), 522 que la conexión expiró (IP equivocada, sobrecarga), 524 que la conexión funcionó pero el origen no respondió en 100 segundos, 525/526 problemas TLS con el certificado del origen (cambia a Full strict con un certificado de origen, o a Flexible). Siempre señalan a tu servidor o al camino hasta él, nunca al visitante.

Preguntas

¿Cuál es la diferencia entre 404 y 410?

404 dice que ahora no hay nada aquí; 410 dice que estuvo aquí y se eliminó a propósito. Los buscadores descartan antes una URL 410. Usa 410 para contenido borrado que no vas a restaurar.

¿Debe una API devolver 200 con un error en el cuerpo?

No. Clientes, proxies, cachés y monitorización se guían por el código de estado. Usa 4xx para errores del cliente y 5xx para fallos del servidor, con detalles en el cuerpo (problem+json del RFC 9457 es la forma estándar).

¿Por qué obtengo 502 de nginx?

nginx no pudo obtener una respuesta válida del upstream: la app no se ejecuta, escucha en otro puerto o socket, se cayó a mitad de la petición o envió cabeceras que nginx rechaza. Mira los registros de la app y el registro de errores de nginx, no el navegador.

¿Qué significa 429 y qué debo hacer?

Demasiadas peticiones: has alcanzado un límite de tasa. Espera el tiempo de la cabecera Retry-After y reintenta con backoff. Para APIs, reparte las llamadas o solicita una cuota mayor.