1. Home
  2. Knowledge Base
  3. Fixing 504 Gateway Errors

Fixing 504 Gateway Errors

Generally if your site is getting a 504 Gateway Error is means it’s hit some sort of resource limit and all the PHP workers are busy.

There are generally two types of resources that have hit the limit in this scenario:

  1. CPU limit where the CPU on your hosting plan is maxxed out processing existing requests and cannot handle any more in a timely fashion thus the web server throws a 504 error
  2. A PHP worker limit where the available PHP worker limit has been hit with the existing requests and no more workers are available to process requests.

The root cause of this problem is usually one of three things:

1. Genuine server load – you’ve done a mailout or some other marketing has suddenly spiked traffic
2. Some configuration error where caching has been turned off or caching plugins have been disabled or are being bypassed with a custom query string which has the same effect as turning off caching
3. The site is being attacked by crawlers, scrapers or brute force attacks that are chewing up resources and temporarily all PHP workers are exhausted.

Our support team should be able to quickly diagnose and fix the issues for you if you log a ticket or start a live chat. The fixes are generally one of the following:

  1. We can temporarily (or permanently) increase server resources. If you’re not using Cloudflare APO then this typically will assist greatly too.
  2. Get your caching enabled again or add rules to your caching plugin so the query strings are being cached too.
  3. Change your PHP worker limit so more workers are available
  4. Review your logs and tweak the security and firewall setup, add disallows to your robots.txt file to block crawlers hammering resources they shouldn’t be or add new Cloudflare security rules to filter things like brute force attacks at the Cloudflare layer instead of WordPress or hosting layer.

Need Support?

Can't find the answer you're looking for? Log a request by clicking the button below or try the livechat in the bottom right hand corner
Contact Support