HTTP error codes are crucial to the understanding client and server-side issues, This is a comprehensive guide for HTTP error codes and their underlying reasons:
And the Best Part:
You will learn everything from a system administrator’s perspective, so you will be well equipped to solve those issues in a jiffy.
- Most common HTTP error codes?
- What do they mean?
- What are the common solution or fixes that you can try?
- A comprehensive list of all HTTP errors and other resources if you wish to explore more.
HTTP error codes indicate whether an HTTP request was successfully completed or
The HTTP responses are grouped into these five categories:
- Informational codes: 1xx,
- Success codes: 2xx,
- Redirects: 3xx,
- Client errors: 4xx,
- Server errors: 5xx
We will be focusing on the most common client and server side error codes namely 4xx and 5xx codes and common solutions to these codes.
Client error overview: Client-side errors are caused due to the client. This means that there is something wrong with the request that the client is sending to the server.
General errors include typo’s and maybe the headers are wrong or some such thing.
Server error overview: Server errors that code from 500 to 599 are sent when there is an error with the server or when the server recognizes that it is unable to handle the request.
General fixes and other tips to troubleshoot:
- This goes without saying but this mistake is what many people do when doing server debugging.
- Refresh the browser or the server debugging software after making changes to the server.
- Check server logs
HTTP server codes are determined by standards that are implemented by the software running on the server. This means that the actual code returned by the server depends on how the server software handles the code.
This guide should generally point you in the right direction. Now that you have a general understanding this will help you in
Common Client Side HTTP error codes:
400 (Bad request error)
This code means that the server could not understand the request because the syntax is invalid. That is the request which was sent to the server had invalid syntax.
- Check the syntax errors that might have occurred in your request.
- Try clearing the browser’s cookies and cache.
- Try updating or changing the browser. That is browser might be really old/outdated and or faulty.
401 Unauthorized error:
In this case
Provide the proper authentication, in a proper way that is required by the server to access the restricted content.
In this case the client does not have access to the content. it means that server recognises who the client is and the user has made a proper request to the server but the server is refusing to give a proper response to access to the requested files. Unlike the 401 here the client’s identity is known to the server.
403 errors commonly occur when users does not have the permissions to access the requested resource.
404 Not Found:
The HTTP error code: 404 not found means that the user is able to communicate with the server and the server is also willing to send the resource back to the user, but it is unable to find the resource the user is requesting.
If you are using a browser it might also mean that the URL is not recognised by the server. Or as I ssaid above it might also mean that the URL is valid but the resource no longer exists on the server.
This is one of the most recognisable error code on the web because of it’s frequent occurrence.
If you are receiving a 404 error unexpectedly, here are a few questions to ask while troubleshooting.
- Did you make a type error.
- Does the file exist on the server or has it moved or been deleted ?
- Is the file you are requesting in the directory that you are looking into.
408 Request Timeout:
This response is sent when the server closes the connection because the client is taking a long time to send the request. This happens when the client has a slow internet connection or if there is a huge load on the server.
Be aware that this error response is also often sent by servers even without any previous request by the client. It means that the server wishes to shut down this unused connection.
Nowadays, any modern browsers
429 Too Many Requests
The user sent too many requests in a given amount of time. This is generally done as a rate limiting measure. Often time providers of free API’s (for example: free weather api etc.) limit the rate at which the free user can access the data.
Wait for some time and try again or read the terms associated with API access point.
Detailed comprehensive list of HTTP error codes:
For a detailed list of HTTP error codes and their meaning please refer to this resource by Mozilla: HTTP response status codes
Common server-side HTTP error codes:
500 Internal server error:
The server has encountered an error and it does not know how to handle it. Sometimes the code will appear with more specific errors of the 5xx type.
The most common cause for this type of error is server misconfiguration.
502 Bad Gateway:
This means that the server while working to get a response from another server that is needed to handle the request got an invalid response.
That is the server which the client sent a request to is a proxy server and needs to get the data from another server.
That is the server which the client sent a request to is a proxy server and needs to get the data from the parent server. The proxy server is not able to get a valid response from the parent server.
The most common cause for this is server misconfiguration. Having missing packages or not properly load balancing the server might result in these errors.
503 Service Unavailable:
Means that server is unable to handle the request possible cause may be that the server is under maintenance or down for some other reason or that the server is over loaded and cannot handle the request.
If the server is not down then it means that either the server resources such as CPU ram or bandwidth are unable to handle the traffic. Either server needs to be reconfigured to allow more traffic by increasing the resources or some other
Note: If you are sending this response during heavy load times or for some other reason a user friendly html page or message should also be send explaining the problem and an estimated time frame for the resolution of the problem. For this you can also user the Retry-After: HTTP header.
You should also take care not to send caching-related headers during these temporary conditions.
504 Gateway Timeout
This error is recieved when the server is acting as a gateway or a proxy server and is unable to get a response from the proxy servers in the stipulated time period.
Main causes and solution for this:
- There is heavy load on the parent server.
- There is a lot of latency between the servers because of location or slow bandwidth
You are now familiar with Common HTTP error codes and
Hi, I am Mohammed Lakkadshaw for more information about me please visit my blog and website: https://www.mohammedlakkadshaw.com