The derided 503 error message is possibly one of the most frustrating errors to encounter when trying to access a website, not just as a developer but as a general user.
As is the case with most other HTTP errors, including the 502 bad gateway error, there’s no way for you to tell precisely what has gone wrong. Unless you’re au fait with website development, it’s likely that the error number is as helpful to you as the broken website you’re trying to access.
HTTP vs HTTPS: What difference does it make to security?
Kazakh government will intercept the nation’s HTTPS traffic
What is a 502 bad gateway and how do you fix it?
However, there are some steps you can take to try and fix the issue, although it’s possible the problem is with the web server the browser is trying to access.
What does HTTP error 503 mean?
A 503 error displays when something has prevented a browser from accessing the server of a target website – typically that the server has been unable to handle the information request, although the reason for this won’t be obvious.
Get the IT Pro newsletter
Get the free daily newsletter from IT Pro, delivering the latest news, reviews, insights and case studies
Your email address
The error is normally accompanied by a handful of suggested actions to help remedy the situation, although one of these will be to simply try and access the website at a later time. While this advice can be frustrating, and useless for helping you solve the problem, some sites simply display a blank error page.
What causes a HTTP error 503?
As is the case with the 502 bad gateway error, diagnosing the cause of a 503 error is difficult. Usually, it’s the case that something has gone wrong with the server supporting the website you’re trying to access.
The most common cause of the 503 error is a breakdown in communication between the server and the website it is supporting, resulting in that website being unable to handle any information requests from a user’s browser. This could have been due to scheduled server maintenance or by some unforeseen technical issue. If the latter, you might find that some websites are down more regularly than others, normally a sign that their hosting provider is inadequate.
A 503 error may also occur if the server is still online but lacks sufficient capacity to support the number of requests hitting a website. This often happens when a website that normally sees low traffic is suddenly hit with an influx of new users. This spike in traffic can be from users flocking to the site, such as when a promotional deal is running, however, it’s most often the case that these spikes are caused by malicious traffic, such as a distributed denial of service (DDoS) attack.
Misconfigured web apps may also cause a 503 error to appear, such as a plugin conflict caused by WordPress.
Regular 503 errors could suggest an issue with the domain name system (DNS), whether that’s an incorrect server configuration or an issue with the DNS server itself.
Figuring out precisely what’s gone wrong is important for ultimately getting a site back online.
How to fix an HTTP error 503
The easiest solution is to refresh the page and see if that can bring it back.
You can also attempt to restart your computer or router. If the error message shows “Service Unavailable – DNS Failure”, there may be a fault with the DNS configuration of the computer or the router. A router problem can be fixed by restarting it. In the case of a problem with a selected DNS server, it may be fixed by choosing another DNS server to use.
Unfortunately, if the 503 error is the result of a server-side issue, there’s nothing much you can do as a site visitor to fix the problem.
If a site’s visitors are reporting HTTP 503 errors on a regular basis, then the administrator needs to troubleshoot the issue and find the appropriate fix. If there are updates needed for a website, schedule these at a quieter time so that users don’t see this message regularly.
If spikes in traffic are causing the error, then it may well be time to increase web server resources to cope with the increase in visitors.
If the error is caused by a denial of service (DoS) attack, it’s worth contacting a hosting provider to see what mitigations can be put in place to avoid this happening again. You may want to look at increasing security or applying patches that hackers may use to attack your website and take it offline. Many hosting providers have DDoS protection in place, which can limit the number of users being funnelled to a site at any given time.
Lastly, if the error is due to a programming error, further investigation will be required to pinpoint the issue and take steps to correct it.
Errors happen – there’s some unexpected maintenance, a bug that went unnoticed, or a page goes viral and the flood of connections take the server down.
If you’ve been online for any amount of time, no doubt you’ve seen the somewhat vague 503 Service Unavailable error.
In this article we’ll go over HTTP status codes, what the 503 error means, and some possible ways to solve it – both for a site you’re trying to visit and for your own site.
An overview of HTTP status codes
Servers that host web pages listen for requests from web browsers or devices, also known as clients. The server then uses a bunch of different status codes to communicate back.
These status codes are organized into different classes, which is indicated by the first number of the status code:
1xx: Information – the server is still processing the request
2xx: Success – the request succeeded and the server responds with the page or resource
3xx: Redirection – the page or resource has moved and server will respond with its new location
4xx: Client error – there is an error in the request from the browser or device
5xx: Server error – there is an error with the server
The last two digits of each HTTP status code represent a more specific status for each class. For example, 301 means that a page or resource has moved permanently, while 302 means the move is temporary.
Check out this page for a list of common HTTP status codes and their meaning: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Most status codes go by totally unnoticed, which is fine because it means everything is working. It’s only when you get to the 4xx-5xx range that you might notice a status code because you’ll see a page like this:
A typical 503 error page – Source: Stack Overflow
Now that you have a basic understanding of HTTP status codes, let’s dig a bit deeper into the 503 Service Unavailable error.
What does the 503 error code mean?
As mentioned above, 5xx status codes mean there’s a problem with the server itself.
A 503 Service Unavailable error means that the page or resource is unavailable. There are many reasons why a server might return a 503 error, but some common reasons are maintenance, a bug in the server’s code, or a sudden spike in traffic that causes the server to become overwhelmed.
The message that’s sent with the 503 error can vary depending on server it’s coming from, but here are some of the common ones you’ll see:
- 503 Service Unavailable
- 503 Service Temporarily Unavailable
- HTTP Server Error 503
- HTTP Error 503
- Error 503 Service Unavailable
- The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Whatever the reason for the 503 error, it’s usually temporary – the server will restart, traffic will die down, and the issue will resolve itself.
How to solve the 503 Status Unavailable error
When trying to solve a 503 error, there are two general camps.
The first is where you’re an end user, and you’re trying to visit a site that you don’t own. In the second, you own the site, and it’s throwing 503 errors to people who are trying to visit.
The method to solve 503 errors is different depending on which group you fall into. Let’s take a look at some things you can do as an end user if you see a 503 error.
How to solve a 503 Status Unavailable error as an end user
Since 5xx status codes mean that the error is on the server-side, there isn’t a lot you can do directly.
Even though 503 errors are usually temporary, there are some things you can do while you wait.
1: Refresh the page
Sometimes the error is so temporary that a simple refresh is all it takes. With the page open, just press Ctrl – R on Windows and Linux, or Cmd – R on macOS to refresh the page.
2: See if the page is down for other people
The next thing you can do is use a service like Is It Down Right Now? or Down For Everyone Or Just Me to see if other people are getting the same error.
Just go to either of those sites and enter in the URL for the page you’re trying to visit.
The service will ping the URL you entered to see if it gets a response. Then it’ll show you some cool stats and graphs about the page:
Checking freeCodeCamp on Is It Down Right Now?
If you scroll down a bit you’ll see some comments from other people. Often people will give their general location and other data, so this can be a good way to determine if the error is just affecting certain regions or specific devices.
3: Restart your router
Sometimes the issue has to do with a DNS server failure.
DNS stands for Domain Name System, and they basically act as translators between IP addresses and human readable URLs.
For example, you can visit Google by entering its long IP address directly (126.96.36.199), or you can just enter in the URL, www.google.com.
It’s a DNS, often hosted on a server, that handles all that behind the scenes.
All of that is to say, many routers cache responses from DNS servers (www.google.com <==> 188.8.131.52). But sometimes this cache can get corrupted and cause errors.
An easy way to reset or “flush” the cache is to restart your router. Just unplug your router for about 5 seconds, then plug it back in again.
It should restart after a minute and all of your devices should reconnect automatically. Once they do, try visiting the site again.
How to solve a 503 Status Unavailable error as the site’s owner
If you are the owner/developer of the site that’s returning 503 errors, there’s a bit more you can do to diagnose and resolve the issue.
Here are some general tips to get you started:
1: Restart the server
Development is tough – even a simple static page can have so many moving parts that it can be difficult to pin down what’s causing the 503 error.
Sometimes the best thing to do is to restart the server and see if that fixes the issue.
The exact method of restarting your server can vary, but usually you can access it from your provider’s dashboard or by SSH’ing into the server and running a restart command.
The server should restart after a couple of minutes. If you’ve configured everything to run automatically on boot, you can visit your site and see if it’s working.
2: Check the server logs
The next thing to do is check the logs.
The location of the server logs can vary depending on what service you’re running, but they’re often found in /var/log/….
Take a look around that directory and see if you can find anything. If not, check the manual for your programs by running man program_name.
3: Check if there’s ongoing automated maintenance
Some service providers offer automated package updates and maintenance. Normally this is a good thing – they usually occur during downtime, and help make sure everything is up-to-date.
Occasionally 503 errors are due to these scheduled maintenance sessions.
For example, some hosting providers that specialize in WordPress hosting automatically update WP whenever there’s a new release. WordPress automatically returns a 503 Service Unavailable error whenever it’s being updated.
Check with your service providers to see if the 503 error is being caused by scheduled maintenance.
4: Check your server’s firewall settings
Sometimes 503 Service Unavailable errors are cause by a misconfigured firewall where connections can get through, but fail to get back out to the client.
Your firewall might also need special settings for a CDN, where multiple connections from a small handful of IP addresses might be misinterpreted as a DDoS attack.
The exact method of adjusting your firewall’s settings depends on a lot of factors. Take a look at your pipeline and your service provider’s dashboards to see where you can configure the firewall.
5: Check the code
Bugs, like errors, happen. Try as you might, it’s impossible to catch them all. Occasionally one might slip through and cause a 503 error.
If you’ve tried everything else and your site is still showing a 503 Service Unavailable error, the cause might be somewhere in the code.
Check any server-side code, and pay special attention to anything having to do with regular expressions – a small regex bug is what caused a huge spike in CPU usage, rolling outages, and about three days of panic for us at freeCodeCamp.
Hopefully you’ll be able to track down the culprit, deploy a fix, and everything will be back to normal.
That should be everything you need to know about 503 Service Unavailable errors. While there’s usually not much you can do when you see a 503 error, hopefully some of these steps will help the next time you encounter one.
Stay safe, and happy refreshing-until-it-works 🙂