HTTP response codes, i.e. the popular 404 403 301 302 200

Understand HTTP response codes, including 200, 301, 403 and 404. Learn their classes and their meaning for server-client communication.

An HTTP response code is nothing more than information sent by the server to the client (usually to the browser), informing how the client's request was handled. A diagram of the client-server communication model:

http

Informational codes:

Code Description Meaning
100 Continue request to continue sending the request
101 Switching Protocols protocol change
110 Connection Timed Out maximum connection time exceeded
111 Connection Refused connection rejected by the server

Success codes:

Code Description Meaning
200 OK content of the requested document
201 Created created - the submitted document was saved on the server
202 Accepted accepted - the request was accepted for processing, but its processing hasn't finished yet
203 Non Authoritative Information non-authoritative information - the returned information doesn't exactly match the original server's response, but was created from local or external copies
204 No Content no content - the server processed the client's request and doesn't need to return any content
205 Reset Content reset content - the server processed the request and the client should reset the document's original appearance
206 Partial Content partial content - the server only fulfilled part of a GET request; the response must include a Range header informing about the byte range of the returned item

Redirection codes:

Code Description Meaning
300 Multiple Choices multiple choices - there's more than one way of handling the given request; the server may provide the address of a resource that allows choosing an unambiguous request among the possible options
301 Moved Permanently moved permanently - the requested resource has changed its URI, and in the future the resource should be looked for at the indicated new address
302 Found found - the requested resource is temporarily available at a different address, and future references to the resource should be directed to the original address
303 See Other see other - the response to the request is located at a different URI, and the client should be directed there. This is the proper way of redirecting in response to a POST request.
304 Not Modified not modified - the resource's content has not changed according to a condition passed by the client (e.g. the date of the last version of the resource retrieved by the client - the browser cache)
305 Use Proxy Use a proxy server - the requested resource must be accessed through the proxy server given in the Location header of the response
306 unused code, although reserved for older versions of the protocol
307 Temporary Redirect temporary redirect - the requested resource is temporarily located at a different URI; the response should contain the changed address of the resource, to which the client is required to move
310 Too many redirects too many redirects

Client application error codes:

Code Description Meaning
400 Bad Request bad request - the request cannot be processed by the server due to malformed request syntax
401 Unauthorized unauthorized access - a request for a resource that requires authentication
402 Payment Required Payment required - a response reserved for future use (some services already use it)
403 Forbidden Forbidden - the server understood the request, but its security configuration forbids it from returning the requested resource
404 Not Found not found - the server did not find a resource matching the given URL, nor anything indicating such a resource ever existed
405 Method Not Allowed method not allowed - the method contained in the request is not allowed for the specified resource; the response also contains a list of allowed methods
406 Not Acceptable not acceptable - the requested resource is unable to return a response that can be handled by the client according to the information provided in the request
407 Proxy Authentication Required proxy authentication required - analogous to code 401, concerns access to the proxy server
408 Request Timeout request timeout - the client did not send a request to the server within the specified time
409 Conflict conflict - the request cannot be fulfilled because there is a conflict with the resource's current status; this response code is only returned when the server suspects the client might not find the cause of the error and might send a valid request
410 Gone gone (removed) - the requested resource is no longer available, and its possible new URI is unknown; the client should no longer refer to this resource
411 Length required length required - the server refuses to fulfill the request because the request lacks a Content-Length header; the client may repeat the request after adding a correct length header
412 Precondition Failed precondition failed - the server cannot fulfill at least one of the conditions contained in the request
413 Request Entity Too Large request entity too large - the total length of the request is too long for the server
414 Request-URI Too Long request URI too long - the length of the requested URI is greater than the maximum expected by the server
415 Unsupported Media Type unknown request method - the server refuses to accept the request because its syntax is not understood by the server
416 Requested Range Not Satisfiable the byte range given in the request cannot be handled - the client provided a range in the request that cannot be applied to the specified resource
417 Expectation Failed expected value cannot be returned - the expectation given in the request's Expect header cannot be met by the server, or - if the request is being handled by a proxy server - the server has evidence that the expectation will not be met by the next server in the chain handling the request

Server error codes:

Code Description Meaning
500 Internal Server Error internal server error - the server encountered unexpected difficulties that prevented it from fulfilling the request
501 Not Implemented not implemented - the server does not have the functionality required by the request; this code is returned when the server received an unknown type of request
502 Bad Gateway bad gateway - the server, acting as a gateway or proxy, received an invalid response from an upstream server and cannot fulfill the client's request
503 Service Unavailable service unavailable - the server is currently unable to fulfill the client's request due to overload
504 Gateway Timeout gateway timeout - the server, acting as a gateway or proxy, did not receive a response within the set time from the specified HTTP, FTP, LDAP, etc. server, or a DNS server is needed to handle the request
505 HTTP Version Not Supported HTTP version not supported - the server does not support or refuses to support the HTTP version indicated by the client