You search for anything on Google, and by this, a request is being sent to the server, then the server responds. This response is done using HTTP (HyperText Transfer Protocol) by the server. There can be two cases – the server may respond with the information it has, or else it may show an error with a code. Whenever there’s an error in the back end, the server responds with an error code that explains what error could have happened.
The HTTP status code is a response made by the server to the client’s request. These are three-digit codes, while there are more than 60 error status codes, we’ll go through some of the major HTTP status codes which are printed generally.
Let’s discuss status codes with their meanings:
- 1xx – Informational Response (These status codes are all about the information received by the server when a request is made).
- 2xx – Success (This status code depicts that the request made has been fulfilled by the server and the expected response has been achieved).
- 3xx – Redirection (The requested URL is redirected elsewhere).
- 4xx – Client Errors (This indicates that the page is not found).
- 5xx – Server Errors (A request made by the client but the server fails to complete the request).
Let’s go through some Major HTTP Status Codes:
1. 200 (Success/OK)
The HTTP status code 200 represents success which means the page you have requested has been fetched. The action made has been accepted and has been delivered to the client by delivering the requested page.
- GET: entity in reference to the requested source sent to the response
- POST: entity describing the response of action made
- HEAD: an entity-header field similar to the requested source
- TRACE: a request made by the client is taken care of by the server
2. 301 (Permanent Redirect)
The HTTP status code 301 means that the page you have requested has moved to a new URL and which is permanent. In the future, whenever the user requests the same website, it will be redirected to the new URL. The modified permanent URL is given by the location filed in response.
3. 302 (Temporary Redirect)
The requested URL has been redirected to another website which is temporary. Major changes in the URL will be in the future. Other than GET or HEAD, if the 302 is received in response to a request. The redirection is temporarily redirected to another website.
4. 304 (Not Modified)
HTTP status code 304 is used for caching purposes. The response has not been changed so that in the future the client can resume the same cache. If there’s a GET request and access is allowed, but the document has not been modified. The response MUST NOT contain a message-body and therefore comes to an end by the first empty line.
5. 400 (Bad Request)
When the client requests a page and the server is not able to understand anything, it displays a 400 HTTP status code. The client SHOULD NOT repeat the request without any changes. The request can be a malformed, deceptive request routing, or invalid request.
6. 401 (Unauthorized Error)
This HTTP status code requires user authentication. The response includes the WWW-Authenticate header field containing a challenge applied to a requested source. HTTP access authentication “HTTP Authentication: Basic and Digest Access Authentication”.
7. 403 (Forbidden)
The HTTP status code 403 implies that the request is understood by the server, but still refuses to fulfill it. If the request method was not HEAD and also the server wants to make it public when the request is not completed, it SHOULD tell the reason for the refusal in the entity.
8. 404 (Not Found)
404 HTTP Status code appears when you request a URL and then the server has not found anything. This happens when the server doesn’t wish to describe the reason why the request has been refused. Also, the server is not able to find a representation for the target resource.
9. 500 (Internal Server Error)
500 HTTP status code means requesting a URL is not fulfilled because the server encounters an unexpected condition. It gives information about the request made if it is successful, and throws an error. When there’s an error during a connection to the server, and the requested page cannot be accessed then this message is displayed.
10. 501 (Not Implemented)
When a request is made by the client, the server is not able to recognize the request method and is not able to support any resource. By default. it is cacheable. The methods, the server requires to support are GET and HEAD. The server does not support the functionality required to fulfill the request.
Other HTTP Status Codes Are:
100 Continue
101 Switching Protocol
102 Processing (WebDAV)
103 Early Hints
200 OK
201 Created
202 Accepted
203 Non-Authoritative Information
204 No Content
205 Reset Content
206 Partial Content
207 Multi-Status (WebDAV)
208 Already Reported (WebDAV)
226 IM Used (HTTP Delta encoding)
300 Multiple Choice
301 Moved Permanently
302 Found
303 See Other
304 Not Modified
305 Use Proxy
306 Unused
307 Temporary Redirect
308 Permanent Redirect
400 Bad Request
401 Unauthorized
402 Payment Required
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable
407 Proxy Authentication Required
408 Request Timeout
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Payload Too Large
414 URI Too Long
415 Unsupported Media Type
416 Range Not Satisfiable
417 Expectation Failed
418 I’m a teapot
421 Misdirected Request
425 Too Early
426 Upgrade Required
428 Precondition Required
429 Too Many Requests
431 Request Header Fields Too Large
451 Unavailable For Legal Reasons
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported
506 Variant Also Negotiates
507 Insufficient Storage (WebDAV)
508 Loop Detected (WebDAV)
510 Not Extended
511 Network Authentication Required