HTTP is short for HyperText Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands. HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes: informational responses, successful responses, redirects, client errors, and servers errors.
HTTP Status Code – Informational
- A status code of 100 indicates that (usually the first) part of a request has been received without any problems, and that the rest of the request should now be sent.
101 Switching Protocol
- HTTP 1.1 is just one type of protocol for transferring data on the web, and a status code of 101 indicates that the server is changing to the protocol it defines in the “Upgrade” header it returns to the client. For example, when requesting a page, a browser might receive a status code of 101, followed by an “Upgrade” header showing that the server is changing to a different version of HTTP.
HTTP Status Code – Successful
200 - OK
- The 200 status code is by far the most common returned. It means, simply, that the request was received and understood and is being processed.
201 - Created
- The request has succeeded and a new resource has been created as a result of it. This is typically the response sent after a PUT request.
202 - Accepted
- The status code 202 indicates that server has received and understood the request, and that it has been accepted for processing, although it may not be processed immediately.
203 - Non-Authoritative Information
- This response code means returned meta-information set is not exact set as available from the origin server, but collected from a local or a third party copy. Except this condition, 200 OK response should be preferred instead of this response.
204 - No Content
- The 204 status code means that the request was received and understood, but that there is no need to send any data back.
205 - Reset Content
- This response code is sent after accomplishing request to tell user agent reset document view which sent this request.
206 - Partial Content
- A status code of 206 is a response to a request for part of a document. This is used by advanced caching tools, when a user agent requests only a small part of a page, and just that section is returned.
HTTP Status Code – Redirection
300 - Multiple Choices
- The server has several actions available based on the request. The server may choose an action based on the requestor (user agent) or the server may present a list so the requestor can choose an action.
301 - Moved Permanently
- The requested page has been permanently moved to a new location. When the server returns this response, it automatically forwards the requestor to the new location. The response should also include this location. It tells the client to use the new URL the next time it wants to fetch the same resource.
302 - Found
- A status code of 302 tells a client that the resource they asked for has temporarily moved to a new location. The response should also include this location. It tells the client that it should carry on using the same URL to access this resource.
303 - See Other
- A 303 status code indicates that the response to the request can be found at the specified URL, and should be retrieved from there. It does not mean that something has moved – it is simply specifying the address at which the response to the request can be found.
304 - Not Modified
- If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server SHOULD respond with this status code. The 304 response MUST NOT contain a message-body, and thus is always terminated by the first empty line after the header fields. If the client has done a conditional GET and access is allowed, but the document has not been modified since the date and time specified in If-Modified-Since field, the server responds with a 304 status code and does not send the document body to the client. Response headers are as if the client had sent a HEAD request, but limited to only those headers which make sense in this context. This means only headers that are relevant to cache managers and which may have changed independently of the document’s Last-Modified date. Examples include Date , Server and Expires . The purpose of this feature is to allow efficient updates of local cache information (including relevant meta information) without requiring the overhead of multiple HTTP requests (e.g. a HEAD followed by a GET) and minimizing the transmittal of information already known by the requesting client (usually a caching proxy).
305 - Use Proxy
- The requested URL must be accessed through the proxy mentioned in the Location header.
307 - Temporary Redirect
- The server is currently responding to the request with a page from a different location, but the requestor should continue to use the original location for future requests. There is very little difference between a 302 status code and a 307 status code. 307 was created as another, less ambiguous, version of the 302 status code.
HTTP Status Code – Client Error
400 - Bad Request
- The server didn’t understand the syntax of the request.
401 - Unauthorized
- The request requires authentication, before a resource can be accessed, the client must be authorized by the server. The server might return this response for a page behind a login.
402 - Payment Required
- The 402 status code is not currently in use, being listed as “reserved for future use”.
403 - Forbidden
- The server is refusing the request. Unlike a 401 unauthorized response, authenticating will make no difference.
404 - Not Found
- The server can’t find the requested page. For instance, the server often returns this code if the request is for a page that doesn’t exist on the server.
405 - Method Not Allowed
- A 405 status code is returned when the client has tried to use a request method that the server does not allow. Request methods that are allowed should be sent with the response (common request methods are POST and GET).
406 - Not Acceptable
- The 406 status code means that, although the server understood and processed the request, the response is of a form the client cannot understand. A client sends, as part of a request, headers indicating what types of data it can use, and a 406 error is returned when the response is of a type not i that list.
407 - Proxy Authentication Required
- The 407 status code is very similar to the 401 status code, and means that the client must be authorised by the proxy before the request can proceed.
408 - Request Timeout
- A 408 status code means that the client did not produce a request quickly enough. A server is set to only wait a certain amount of time for responses from clients, and a 408 status code indicates that time has passed.
409 - Conflict
- A 409 status code indicates that the server was unable to complete the request, often because a file would need to be editted, created or deleted, and that file cannot be editted, created or deleted.
410 - Gone
- The server returns this response when the requested resource has been permanently removed. It is similar to a 404 (Not found) code, but is sometimes used in the place of a 404 for resources that used to exist but no longer do. If the resource has permanently moved, you should use a 301 to specify the resource’s new location.
411 - Length Required
- The 411 status code occurs when a server refuses to process a request because a content length was not specified.
412 - Precondition Failed
- A 412 status code indicates that one of the conditions the request was made under has failed.
413 - Request Entity Too Large
- The 413 status code indicates that the request was larger than the server is able to handle, either due to physical constraints or to settings. Usually, this occurs when a file is sent using the POST method from a form, and the file is larger than the maximum size allowed in the server settings.
414 - Request-URI Too Long
- The 414 status code indicates the the URL requested by the client was longer than it can process.
415 - Unsupported Media Type
- A 415 status code is returned by a server to indicate that part of the request was in an unsupported format.
416 - Requested Range Not Satisfiable
- A 416 status code indicates that the server was unable to fulfill the request. This may be, for example, because the client asked for the 800th-900th bytes of a document, but the document was only 200 bytes long.
417 - Expectation Failed
- The 417 status code means that the server was unable to properly complete the request. One of the headers sent to the server, the “Expect” header, indicated an expectation the server could not meet.
HTTP Status Code – Server Error
500 - Internal Server Error
- A 500 status code (all too often seen by Perl programmers) indicates that the server encountered something it didn’t expect and was unable to complete the request.
501 - Not Implemented
- 501 status code indicates that the server does not support all that is needed for the request to be completed.
502 - Bad Gateway
- A 502 status code indicates that a server, while acting as a proxy, received a response from a server further upstream that it judged invalid.
503 - Service Unavailable
- A 503 status code is most often seen on extremely busy servers, and it indicates that the server was unable to complete the request due to a server overload.
504 - Gateway Timeout
- A 504 status code is returned when a server acting as a proxy has waited too long for a response from a server further upstream.
505 - HTTP Version Not Supported
- A 505 status code is returned when the HTTP version indicated in the request is no supported. The response should indicate which HTTP versions are supported.