Part 3: Understanding HTTP Status Codes and Their Meanings

Last updated: July 19th 2023

Introduction

This article is a new addition to the series "Introduction to Web Server Setup & Management". In this series, you'll learn how a web server operates and interacts with users, and you'll also learn how to tweak things to improve the experience. And at the end, you'll understand why we built our LAMP/LEMP stacks the way we did. You can also apply this knowledge to other programming languages and environments.

Last week, I drew the differences between HTTP and HTTPS and how incorporating HTTPS into your website can offer a plethora of advantages other than just bolstering security. And throughout this article, I aim to dissect the vast array of popular HTTP codes and explain their meanings and reasons. Let’s go ahead, shall we?

What are HTTP Status Codes?

When you make a request from your browser to a server, it responds with a three-digit code known as an HTTP status code. These codes act as a communication channel between the server and your browser, giving you insight into the type of response you're receiving. Different classes of status codes exist, each conveying specific information relevant to your request.

HTTP status codes help the user or the website owner identify and fix the errors on the site.

How are HTTP status codes identified?

Five classifications of HTTP status codes can provide helpful insights into the response, even if the exact response code is unknown to you:

  • 1xx - Informative: The server has received your request and is working on it.
  • 2xx - Success:  The operation has been completed with success. The anticipated data has been delivered to the browser as expected.
  • 3xx - Redirection: Your request can only be fulfilled with additional steps. As a result, you have been redirected to a page where you can complete the necessary actions.
  • 4xx - Client error:  The client is experiencing technical difficulties accessing the requested page. This may be due to a temporary outage or an error in the request formatting.
  • 5xx - Server error:  Although the inquiry seems proper, the server could not fulfill the request.

How to check the HTTP Status Code?

The 1XX and 2XX codes are not typically shown to end users. Instead, if there is an issue with loading a webpage, the browser may present a 3xx, 4xx, or 5xx response code.

However, using Chrome’s built-in Network monitor, you can look for the status codes of your resources. Simply right-click on a webpage, select inspect element, go to the network tab, and reload the page to see all resources and their status code.

image1.png

Understanding HTTP status codes

The 1xx series

When you send a request to a server, it may respond with a 1xx Informational status code. This code indicates the server has received your request and is currently working on processing it. It's only temporary and will be a partial response to your request. While you may not encounter these codes frequently, they are still crucial to communication between your device and the server.

100 - Continue

When the client receives the status code 100 Continue, it indicates that the server has received the first part of the request and is ready for the client to proceed with the rest of the request. Alternatively, if the request has already been completed, the client should disregard the response altogether.

101 - Switching Protocols

The 101 Switching protocols status code denotes that the server has acknowledged the Upgrade header field request and specifies the particular protocol it will transition to.

102 - Processing

The status code 102 indicates that the server has acknowledged the request in its entirety. However, it is still in the process of completing it, and there is currently no response available.

103 - Early Hints

The purpose of the 103 Early hints status code is to enable the user agent to preload resources while the server is preparing a response. This code is most effective when combined with the Link Header, which makes it a precious tool for optimizing website performance. By integrating this code, users can experience faster load times and seamless browsing without any delay or interruption in their experience.

The 2xx Series

When the browser receives a 2xx Success status code, it indicates that the request has been executed successfully and the expected information has been received. This is the ideal status code to receive, as it signifies that the request has been accepted, understood, and successfully processed.  It is crucial to ensure that all pages and resources return a 2xx status code. This ensures that your website visitors can access and utilize your website with ease, without any technical glitches.

200 - OK

The significance of the 200 OK status code varies depending on the request method utilized. If the request was made using the GET method, it means that the requested resource has been successfully retrieved and transmitted to the message body.

On the other hand, if the request was made using the HEAD method, only the header fields of the requested resource are sent without the message body. For POST or PUT requests, a description of the result of the action is transmitted to the message body.

Meanwhile, if the request was made using the TRACE method, the request messages received by the server are included in the message body.

From an SEO perspective, a 200 OK response code indicates a functioning page wherein all linked pages are working as expected. This status code is ideal for search engine crawlers because it means they can successfully crawl the page and add it to their search index.

201 - Created

After executing the request, if the server responds with a 201 Created status code, it indicates that the operation was successful and that a new resource or resources may have been generated.

203 - Non-Authoritative Information

When a server responds with the 203 Non-Authoritative Information status code, it indicates that the request was processed successfully. However, the meta-information retrieved differs from what is stored on the original server and was instead sourced from a third-party or local copy. This may indicate misconfiguration or mixed content unless used for backup or mirroring purposes.

204 - No Content

When the server has fulfilled a request but there's no content available, it'll respond with the 204 No Content status code. However, to ensure the user agent is up-to-date with the latest resource, it should update its cached headers.

205 - Reset Content

The status code 205 Reset Content indicates that the requested document requires a fresh start from the user's end.

The 3xx Series

When receiving a 3xx Redirection status code, it means your request has been redirected, and further action is required to complete it. Redirect occurs when the requested resource is moved to a new location, and the request will ultimately be successful.

301 - Moved Permanently

The code 301 Moved Permanently signifies that the intended source has a new and permanent URL. Therefore, any mentioning or directing towards this source should be done using one of the URLs disclosed in the response for future reference.

302 - Moved Temporarily

The code 302 Moved Temporarily, also known as "Found", signifies that the URL for the requested resource has been temporarily altered.

307 - Temporary Redirect

When a server needs to reroute a client to a different resource, it utilizes the 307 Temporary Redirect status code. It is important to note that while the client is being redirected, the request method must remain unchanged.

308 - Permanent Redirect

When you see the code 308 Permanent Redirect, it simply implies that the resource you requested has been given a new home permanently.

The 4xx Series

A 4xx Client Error status code will be displayed if a page or resource cannot be accessed. This could be because the page is unavailable or the request is invalid. It is crucial for website owners to avoid such errors as it leads to a frustrating user experience. Such errors could also negatively impact SEO efforts along with user experience.

400 - Bad Request

When the server responds with a 400 Bad Request status code, it indicates that the request sent could not be comprehended due to incorrect syntax.

401 - Unauthorised

If you receive a 401 Unauthorised status code, it signifies that the server needs you to authenticate yourself before proceeding with the request. This means you need the necessary access to perform the action you're attempting.

403 - Forbidden

The 403 Forbidden status code indicates that the client's request has been declined due to a lack of permission to access the requested content. In contrast to a 401 error, the server is aware of the client's identity but cannot grant access to the content.

404 - Not Found

This one is the most famous HTTP status code. If you come across a 404 Not Found status code, it indicates that the server couldn't locate the resource you were looking for. This might be because the resource is no longer available or the server is trying to keep it hidden from unauthorized clients.

408 - Request Timeout

When the server is prepared to await a complete request, the 408 Request Timeout status code indicates that it did not receive one within the allotted timeframe.

The 5xx Series

When you get a 5xx Server error status code, it indicates that the server failed to fulfil your request, despite it being valid. If you're encountering such errors on your website, it's vital to investigate your server's functionality immediately.

500 - Internal Server Error

The occurrence of the "500 Internal Server Error" status code implies that the server has come across an unprecedented scenario and is unable to proceed.

502 - Bad Gateway

A gateway mean that the server is basically just sending the request onwards and not handling it itself, and the destination is not giving a proper response. When a server acts as a gateway to handle a response, it must receive a valid response. However, if it gets an invalid response, the server will issue a 502 Bad Gateway response code. This signifies a hiccup in the communication between the two servers, causing the intended request to fail. It indicates that your NGINX or Apache might be misconfigured or the destination is not working or is invalid.

As an example, in a typical Web Server configuration the destination may be a back-end processing language such as PHP. So, when using php-fpm for example your webserver acts as a gateway whenever a request for a PHP file is made. The webserver  then sends the request to php-fpm and expects php to process the request and return a response. So if you see this code on a server running PHP (or Node or whatever else Apache or Nginx is sending the requests to behind the scenes) then this most likely means that the php-fpm service is not running or is incorrectly configured, so that's the first thing to check.

503 - Service Unavailable

The status code 503 signifies that the server is currently not ready to process the request. This usually happens when the server is undergoing maintenance or experiencing an overload of requests.

504 - Gateway Timeout

When you encounter the 504 Gateway Timeout response code, it indicates that the gateway server was unable to receive a timely response.

508 - Loop

When the server comes across the 508 Loop Detected response code, it indicates that there is an endless loop encountered during the request processing.

Lesser known HTTP status codes

In 2xx Series:

206        Partial Content

207        Multi-Status

208        Already Reported

226        IM Used        

In 3xx Series: 

300        Multiple Choices

303        See Other

304        Not Modified

305        Use Proxy

306        Switch Proxy          

In the 4xx Series:        

405        Method Not Allowed

406        Not Acceptable

407        Proxy Authentication Required

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

422        Unprocessable Entity

423        Locked

424        Failed Dependency

425        Too Early

426        Upgrade Required

428        Precondition Required

429        Too Many Requests

431        Request Header Fields Too Large

451        Unavailable For Legal Reasons          

In the 5xx series:

501        Not Implemented

505        HTTP Version Not Supported

506        Variant Also Negotiates

507        Insufficient Storage

510        Not Extended

511        Network Authentication Required

Conclusion

The response that a site's server sends is crucial for the functioning and performance of the website. These messages may only sometimes be visible to the user, but they provide essential information about the site's status and any potential issues.

HTTP status codes are divided into five categories, each representing a different aspect of the server's response. These categories range from informational messages to client and server errors, each providing specific details about the nature of the problem.

By understanding these codes, website owners can quickly identify and troubleshoot issues, ensuring their site remains functional and optimized for search engines. This knowledge can help preserve the site's performance and provide a positive user experience.

Aayush Nair has been designing WordPress websites for eight years now. He is also a content writer, writing blogs on technology and related topics, and likes helping people in his free time.

We use cookies. Please see our Privacy Policy.