While we’d all love our websites to run 24/7, 365 days a year without any errors, every now and then you may experience an issue. Sometimes, your website may be broken enough that it can’t show an error or it may be the web server itself displaying an error to you.
The HyperText Transfer Protocol (HTTP) and HyperText Transfer Protocol Secure (HTTPS) are the key protocols used to communicate between your web browser and the web server. For example, here’s a very basic example:
While this is a simplified view, when the web server returns the data it’ll also send back a status code so that the browser knows if it was successful (200) or not.
While the list below isn’t all of the status codes, these are the common ones you may experience as well as some easy to understand examples of when they occur and what you action you need to take (if any).
200 OK
Meaning | The request has succeeded. |
Example
Any website which loads without error. This is the code you expect to see from your web server most of the time.
301 Moved Permanently
Meaning | The requested resource has been assigned a new permanent Uniform Resource Identifier (URI) and any future references to this resource SHOULD use one of the returned URIs. |
Example
If you’ve changed website platforms where the Uniform Resource Locator (URL) is now different, then adding 301 redirects tells the browser (or web crawler, eg Google) that the page, image or similar has moved permanently to a new location.
404 Not Found
Meaning | The server couldn’t find anything matching the request. |
Example
If you’ve deleted a page or renamed an image, it may generate a 404 if someone tries to access it. This is also common when you’ve built a new website and the URL structure has changed, so it’s important to analyse and redirect any broken links to the right location.
403 Forbidden
Meaning | The server denied you access to that page or request. |
Example
403 means that the server received your request, but has denied access to it. This can be commonly seen if you’ve tried to login too many times with the wrong password or if you have blocks on specific pages or directories for your site.
500 Internal Server Error
Meaning | The server tried to process the request but ran into an error. |
Example
If you experience a 500 error, this generally means that there’s a bug or conflict in your website code. For example, if you’ve changed PHP versions and your website now throws 500 errors, it’s likely that the code isn’t compatible with the new version.
502 Bad Gateway
Meaning | Somewhere between the web server and one of the other services couldn’t talk to each other. |
Example
This is generally a temporary error.
For example, if you change PHP versions for your site then you may experience 502 errors for a few seconds while the service is restarting. Make sure you refresh your browser and if the issue still persists after 30 seconds, contact your hosting provider.
Meaning | Your server or website is at capacity or the server is overloaded. |
Example
If you experience 503 errors, it can either mean that your site is hitting resource limits or that the webserver it’s hosted on doesn’t have enough capacity to respond (it may be overloaded).
When you see 503 errors, you can check your web server error logs for more details or contact your hosting provide for further assistance.
504 Gateway Timeout
Meaning | The code for your website took too long and the request timed out. |
Example
A 504 error generally means that the webserver talked to the process handling your website code (eg, PHP) but it took too long and didn’t return any information.
This can occur when you have a process which takes too long to run (eg it’s very resource intensive) or it relies on a third party system which may be down or slow to respond (eg image optimisation servers). You can check your web server error logs for further details or ask your hosting provider to see if they can provide further information.
522 / 524 Connection Timed Out
Meaning | The server didn’t respond back to Cloudflare or similar proxy service |
Example
This can be one you may see if your service is proxied through Cloudflare. It means that Cloudflare tried to talk to your server, but it never received a response in time. It may also appear as a 524 error, which virtually means the same thing.
If it’s a once off, it may that a service on your web server was restarting. This is expected behaviour for web servers and most will restart once a day to flush logs (generally early in the morning).
However, if it’s a continuous issue then it may be a script taking too long to process on your server or the server is overloaded. If you have your own Virtual Private Server, we recommend reviewing the Advanced Monitoring at the time you saw the 522 in order to determine if this is an issue or not.
Other Codes
With more than 50 specified codes, these are just the most common ones you may see when it comes to standard web hosting.
For a full list and basic description of each, we recommend also reading the Mozilla page on the status codes: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
If there’s one we’ve missed that you see all the time, please feel free to let us know in the comments below!
Main Photo by Erik Mclean on Unsplash