It certainly sucks out the air out of you when you load a website only for the browser to greet you with an error, if it is the first time you see the 504 HTTP response status code, then you could be panicking now.
Please take a deep breathe, for in a moment you should be equipped to resolve it.
So you know, this error is not unique to you or to your device or to the browser you are using.
Because it appears on anything that uses the HTTP protocol, you will see a variation of the error message; Gateway Timeout Error, Gateway Timeout (504), HTTP Error 504 – Gateway Timeout, 504 Gateway Timeout, 504 Error, HTTP 504. The denominator in all of them is the number 504.
Another thing to keep in mind is that the 504 status code is a server-side error, implying that in most cases it is nothing to do with you as a user, but on the server hosting the website or any device that facilitates communication to the website.
Now that you have an idea of what the 504 gateway timeout error is, and where the potential fault could be, it’s time to fix it.
How to Fix A 504 Gateway Timeout Error in WordPress?
We shall work our way from the most probable or easy to fix solutions to more complex scenarios.
1. Client-side causes
To access a website, your browser sends a message to the remote server requesting information. If all is good, a 200 success status code is sent out along with the required information.
There is a lot that is happening between your browser and the remote server to complete this simple task facilitated by different technologies and servers. Anything wrong along that path can cause the request to timeout and thus the gateway time out error.
That’s why doing simple things may be the fix.
- Refresh or reload the website. When websites are overloaded to process requests, they tend to time out. It could be that you tried to access the site at this moment, a simple refresh of the browser may be the fix. You may also try waiting for a couple of minutes, then retry.
- Try to access the website in a new browser, computer, or private mode. To rule out if your machine isn’t the issue, try accessing the site from a different device, better from different ISPs.
If the site loads fine yet on your machine it keeps returning the same error; then you need to troubleshoot your computer.
- The simplest thing to do is restart your computer if that doesn’t work; restart all the network devices you use – switches, routers, et.c. I have seen this work plenty of times.
- If you are using a proxy server, verify that you still have the right settings, or if the proxy server is functioning well.
- If you are behind a firewall, check that it’s not somehow causing your traffic to timeout.
- Flush the DNS settings of your computer – for windows in the elevated command prompt enter; ipconfig /flushdns and on a Mac enter sudo killall -HUP mDNSResponder on the terminal.
2. Server related issues
By anything server related I mean anything that a website visitor cannot perform. Only the website owner can accomplish this.
- Could it be that your DNS settings are wrong, or something is up with the DNS server? Test the connection to your DNS servers; you may have to check with your host or your domain registrar if there is no communication with your DNS.
- If you are using a Content Distribution Network (CDN), you may also want to disable it and try to access the website. If your website works fine without the CDN, contact the CDN support informing them of the issue.
- Check that your HTACCESS file has the right configuration. You can rename it, load your website, and see if the error returns.
- Security plugins and firewalls on your WordPress installation or the server may also be culprits, disable them to confirm that your areas still experiencing the error.
- Since we are talking plugins, you could as well disable all the plugins, if that fixed the issue, then isolate the culprit by individually enabling the plugins.
- That goes with the themes too, switch to one of the default WordPress themes, if a buggy theme is an issue, then this will flush it out. If it is the case, update your theme, if you are not the developer, consult with your theme developer for any updates or help. That applies to plugins too.
- If none of that works, then check your WordPress database. Repair and then optimize your database.
- Restore your website from a full backup.
3. Contact support
If you have pulled enough of your hair, if restarting devices doesn’t work, if meddling with your WordPress website does not fix the 504 gateway timeout error, then it is time to use your lifeline – Customer Support that is if you are subscribed to a managed hosting service. If you are not, you may have to hire a consultant.
There is nothing dreadful as having to deal with a broken website. I know what it feels. The sleepless nights, the non-stop raging calls from customers, and oh, the lost business. No one wants that.
That’s why you need to make a deliberate effort to prevent most of these issues.
A backup is a lifesaver; it should be your number one lifeline before customer support comes in. Before I start tinkering with files and databases, I ensure I have securely backed up my data. If I have worked through all I can think of, or if I am lazy, I restore the website from an earlier backup – of course, I do this in a testing environment first.
For your convenience, we have built arguably the best feature packed backup, restoration, migration plugin for WordPress websites – WPvivid Backup Plugin; you should try it today. Did I mention it is free?
I hope I have helped you sort out the 504 gateway error on your WordPress website. You may also want to learn how to fix the 403 forbidden error in WordPress.