Stuck with Cloudflare error 504? Cloudflare error 504 gateway timeout occurs when Cloudflare is unable to establish a connection with the origin web server.
This happens when Cloudflare requests a web page and gets blocked by the site’s web server or firewall or load balancer, resulting in the request timeout.
It can also occur if we change the IP address of the origin web server and did not update the same in the Cloudflare portal.
What causes error 504 gateway timeout?
Some of the main causes for the Cloudflare 504 gateway timeout error is given below:
Receiving 504 from the origin web server is considered as one of the common causes of 504 gateway timeout error.
504 error originating from Cloudflare end.
The 504 gateway timeout error at Cloudflare due to large uploads
How to fix 504 gateway timeout
We will see how our Support engineers troubleshoot and fix Cloudflare 504 gateway timeout error for the above-mentioned causes.
- Fix for Receiving 504 from the origin web server
We will ensure the below aspects at the webserver:
- First we will check whether the IP address is correctly set for the domain in the Cloudflare portal.
- Then we have to ensure that the server firewall is not blocking any connections from Cloudflare. We can whitelist the Cloudflare IP addresses if they are not among the whitelisted IPs on the server.
- High load on the server can also lead to timeout issues and website errors. So we will check whether there are any applications running with high CPU usage, or if any website traffic is there on the webserver.
- Finally we will check if the web-server (httpd, apache, nginx) and Mysql services are properly running in the server by checking their status.
- Fix for 504 error originating from Cloudflare
At times error will be arising from Cloudflare’s end. In this case, Cloudflare will be already aware of the issue and working on it.
However, we will confirm this by checking “https://www.cloudflarestatus.com/.” for the Cloudflare System Status.
For avoiding delays in processing the inquiry request we can provide the following details pro-actively to the Cloudflare Support:
- The exact time and timezone when the issue occurred
- URL that resulted in the HTTP 504 error as a response.
- Fix for 504 Gateway Timeout at Cloudflare Due to Large Uploads
The reason for this is the size of the uploads to the site being too large causing server timeouts.
Cloudflare limits upload file size (per HTTP POST request) to 100 MB for both Free and Pro plans.
This issue can be either on the host’s end or Cloudflare’s end. To find this out we will bypass Cloudflare with the DNS hosts file and try to upload again.