The interaction between the website and the browser is usually done by sending and receiving several command messages, one of which is the HTTP status code. HTTP status code is a number of command messages sent by the browser to a web page to identify a problem.
To find out the HTTP status code message, it is very important for developers or website owners to monitor if something like that happens. For example, suddenly an error 500 occurs on the website, by knowing the meaning of the HTTP status code, the developer or website owner can easily track what is going on.
A few lines of messages from the HTTP code will notify the website owner or developer there is a problem with the configuration on the server or the website itself. HTTP status code is a tool that can be used to diagnose and fix if there are errors in the website.
This time we will discuss one by one the code messages of HTTP status that usually occur on websites and how to overcome them.
1. Brief explanation of HTTP status code
HTTP status code is the response code given on the website. This code is used to identify the cause of the error on the website.
Communication between the browser and the website is by sending some coded messages that the browser sends. The Code type is some code like 401, 404, 403 or 500.
For example code 404, code 404 occurs because the URI that was not requested is not available on the server. When the browser requests a URI and it is not available on the server, what will happen is that the browser will send a 404 code to the website as a sign that the requested process does not fulfill.
In essence, the HTTP status code is the communication between the browser and the website to give or receive certain messages.
2. Types of HTTP status codes and their causes
To find out some of these types of HTTP codes, they are usually grouped into several classifications to distinguish any given information, the classification of the HTTP status code is
International HTTP status code
HTTP status code success/success
HTTP status code redirection
HTTP status code error/error
Error HTTP status code on server.
And here is the explanation and details of the list of status codes from HTTP:
3. International HTTP Code (1xx)
This status code tells you that the request is still in progress for various reasons, here is a list of HTTP 1xx status codes:
1. 100 (Continue)
100 which is an international code indicating that the browser has responded which consists of a status line and an optional header and continues to be processed.
2. 101 (Switching Protocols)
101 indicates that the server has switched to a different protocol according to the user's request.
4. HTTP Status Code Success (2xx)
This type of HTTP code is a response that the request was successfully processed and is working normally, the following is a list of HTTP 2xx status codes:
1. 200 (Ok!)
200 which indicates that the requested process was successfully accepted and understood.
2. 201 (Created)
201 tells that the server has fulfilled the request from the browser by creating a new resource.
3. 203 (Non-authoritative Information)
203 indicates that the request process was successfully fulfilled but came from a different source. Can be through a proxy or other.
4. 204 (No content)
204 indicates the server has fulfilled the request but there is no content in it.
5. 205 (Reset content)
205 is the same as status code 204 does not display the content in it. However, the code 205 tells the user to refresh the view of the document.
6. 206 (Partial content)
206 indicates that the browser has received the request from the server but only part of the requested data.
5. Redirection HTTP Code (3xx)
HTTP code redirect or redirect is a process used to communicate the source with a different location. This code is usually used from one link to another on a website, here is a list of 3xx HTTP status codes:
1. 300 (Multiple choice)
300 has several responses to choose from and the user must select them.
2. 301 (Moved permanently)
301 indicates that the requested URI response has changed and a new URI response will be provided permanently.
3. 302 (Resource moved but was found)
302 is almost the same as the status code 301, the only difference is that the requested URI is only provided temporarily.
4. 303 (See other)
303 occurs when a user makes separate GET requests into different locations to receive data from a PUT, POST or DELETE. Making a request other than the request in HEAD, the server will automatically redirect to another location.
5. 304 (Not modified)
304 indicates a requested page has not been modified or modified since the last request. The server will not display the contents of the page when getting a response from code 304.
6. 305 (Use proxy)
305 appears when the user does not use a proxy when making a request. The status code 305 tells the user to use a proxy and indicates what proxy the user should use.
7. 307 (Temporary redirects)
307 responds to requests from different page locations. Status code 307 replaces status code 302 as an action when resources are temporarily moved to a different URI.
8. 308 (Permanent redirects)
308 is a continuation of the status code 301 which indicates the transfer of URIs to new resources that are permanent.
6. HTTP Status Code Error (4xx)
This HTTP code will be returned by the browser when an error occurs in the server that failed to receive or load. This status code also indicates that there was an error in the user request and prevents the server from processing the requested data, the following is a list of HTTP 4xx status codes:
1. 400 (Bad requests)
This code gives a response because there is an error on the user side. The server does not understand the syntax of requesting data from the user.
2. 401 (Authorized required)
This response occurs when the server requires authentication to display the next response.
3. 403 (Forbidden)
The server or host blocks access and refuses to find requests from users.
4. 404 (Not found)
Indicates that the requested page is not available on the server.
5. 405 (Method not allowed)
This response indicates the method specified in the request that is not allowed by the origin server.
6. 406 (Not acceptable)
The page could not respond with the requested content.
7. 407 (Proxy authentication)
This status code tells the user to authenticate using a proxy and indicates what proxy to use when making a request.
8. 408 (Request timeout)
The server timed out while waiting for the request.
9. 409 (Conflict)
Indicates that there is a conflict in the same resource and the server cannot process it.
10. 410 (Gone)
This status code is similar to 404, the 410 status code tells you that the requested page is indeed permanently lost.
11. 411 (Length required)
Informs that the server only accepts data of content-length in the header and the user must specify the appropriate content-length, in order for the server to accept it.
12. 412 (Pre-condition required)
Appears when the browser includes a certain condition in its header and the server is unable to fulfill the request.
13. 413 (Payload too large)
The server refuses to process the requested request because it is too large to handle.
14. 414 (Request URI is too long)
When making a GET request, the server rejects the requested URI because it is too long for the server to process.
15. 415 (Unsupported media type)
The requested page refuses to support the specified media type.
16. 416 (Request range not satisfiable)
The server refuses to fulfill the request, because the requested range is different from the one specified or is not available. For example, the server specifies a range of 300-500 bytes, but the user requests 100 bytes.
17. 417 (Expectation failed)
The server cannot process the request, because it does not meet the conditions in the specified header.
18. 429 (Too many requests)
Informs that the server is unable to accept requests from the user, this happens because there are too many requests in a certain time. Usually because of bots or automatic scripts that continuously access the page.
19. 499 (Client closed request)
This status code is returned by the NGINX web server, when the user closes the request while NGINX is processing it.
7. Server Problem HTTP Status Code (5xx)
This HTTP code will return a response from the server that an error occurred on the internal server while trying to access the request, the following is a list of HTTP 5xx status codes:
1. 500 (Internal server error)
The server was unable to fulfill the request due to an error on the server.
2. 501 (Not implemented)
This error indicates the server has a function and does not recognize the method to fulfill the request.
3. 502 (Bad gateway)
The server cannot receive a valid response from the upstream as in using a proxy. The server also does not receive the request from the query or in a long time, so the process is stopped by the server.
4. 503 (Service unavailable)
The server shows a condition that is not currently available. Usually used in maintenance that is temporary or overloaded.
5. 504 (Gateway timeout)
This happens because the server does not receive the request and responds within the specified time.
6. 505 (HTTP version not supported)
The server does not support the HTTP protocol used by the user.
7. 521 (Web server is down)
Cloudflare was unable to connect to the origin server within a certain period of time so that it gave an HTTP response status code of 521.
8. 522 (Connection Time Out)
Occurs if a website that uses Cloudflare cannot connect to the origin server for several factors, it could be due to DNS settings errors, a firewall that is blocking Cloudflare, web hosting is down, web hosting is experiencing traffic overload or there is a problem from Cloudflare itself.
9. 523 (Origin is unreachable)
Occurs if a website that uses Cloudflare cannot connect to the origin server due to several reasons such as DNS problems or the origin server is under maintenance.
10. 525 (SSL handshake failed)
This is an error that occurs because the SSL on Cloudflare is not connected to the SSL on the server.
Conclusion
By knowing the status code on HTTP, you can diagnose various errors on your website or server with direction and can solve them properly.