Skip to content

HTTP status codes

The following status codes are supported by the framework. They can be assigned to the response through ctx->response->statusCode or passed to send_default(). Any code not listed here yields an empty status line, so use only the codes below.

For guidance on applying these codes in handlers, see HTTP responses.

Informational

CodeDescription
100 ContinueThe client should continue sending the request body
101 Switching ProtocolsThe server is switching protocols as requested (e.g. WebSocket upgrade)
102 ProcessingThe server has received the request and is still processing it
103 Early HintsPreliminary headers sent before the final response

Successful

CodeDescription
200 OKThe request succeeded
201 CreatedThe request succeeded and a new resource was created
202 AcceptedThe request has been accepted for processing but not yet completed
203 Non-Authoritative InformationThe returned data is a transformed copy of the origin's response
204 No ContentThe request succeeded; the body is intentionally empty
205 Reset ContentThe client should reset the document that sent the request
206 Partial ContentOnly part of the resource is delivered (range request)
207 Multi-StatusThe body carries several separate status codes (WebDAV)
208 Already ReportedThe members of a binding have already been enumerated (WebDAV)
226 IM UsedThe server fulfilled a GET using an instance manipulation

Redirection

CodeDescription
300 Multiple ChoicesThe request has more than one possible response
301 Moved PermanentlyThe resource has permanently moved to a new URL
302 FoundThe resource is temporarily under a different URL
303 See OtherThe client should fetch the response at another URL using GET
304 Not ModifiedThe cached response is still valid; no body is transferred
305 Use ProxyThe resource must be accessed through a proxy (deprecated)
306 Switch ProxyFormerly meant to switch proxies; no longer used
307 Temporary RedirectRepeat the request at another URL, keeping the same method
308 Permanent RedirectThe resource is permanently at another URL, keeping the same method

Client errors

CodeDescription
400 Bad RequestThe server cannot process the request due to malformed syntax
401 UnauthorizedAuthentication is required and was not provided or has failed
402 Payment RequiredReserved for future use; sometimes used for paid access
403 ForbiddenThe client does not have access rights to the content
404 Not FoundNo matching resource was found on the server
405 Method Not AllowedThe request method is not supported for this resource
406 Not AcceptableThe response does not satisfy the client's Accept criteria
407 Proxy Authentication RequiredAuthentication with a proxy is required
408 Request TimeoutThe server timed out waiting for the request
409 ConflictThe request conflicts with the current state of the server
410 GoneThe resource is gone and will not be available again
411 Length RequiredThe request must define a Content-Length
412 Precondition FailedA precondition header evaluated to false
413 Payload Too LargeThe request body exceeds the maximum allowed size
414 URI Too LongThe requested URI is longer than the server will interpret
415 Unsupported Media TypeThe request media type is not supported
416 Range Not SatisfiableThe requested byte range cannot be fulfilled
417 Expectation FailedThe Expect header cannot be satisfied
418 I'm a teapotThe server refuses to brew coffee because it is a teapot (April Fools' RFC)
421 Misdirected RequestThe request was directed at a server unable to produce a response
422 Unprocessable EntityThe request is well-formed but semantically invalid (WebDAV)
423 LockedThe resource is locked (WebDAV)
424 Failed DependencyThe request failed due to a previous dependency (WebDAV)
426 Upgrade RequiredThe client must switch to a different protocol
428 Precondition RequiredThe origin server requires the request to be conditional
429 Too Many RequestsThe client has sent too many requests in a given period
431 Request Header Fields Too LargeThe request header fields are too large
451 Unavailable For Legal ReasonsThe resource is unavailable for legal or regulatory reasons

Server errors

CodeDescription
500 Internal Server ErrorThe server encountered an unexpected error
501 Not ImplementedThe server does not support the request method
502 Bad GatewayA gateway received an invalid response from the upstream
503 Service UnavailableThe server is temporarily unable to handle the request
504 Gateway TimeoutThe upstream server did not respond in time
505 HTTP Version Not SupportedThe HTTP version used in the request is not supported
506 Variant Also NegotiatesTransparent content negotiation failed
507 Insufficient StorageThe server cannot store the representation (WebDAV)
508 Loop DetectedThe server detected an infinite loop processing the request (WebDAV)
510 Not ExtendedFurther protocol extensions are required
511 Network Authentication RequiredNetwork authentication is required to gain access

Released under the MIT License.