How to handle 504 and 521 Errors

Our site utilizes Cloudflare and we have been continuing 500 errors. The most common ones are 504 and 521. Someone will be on the backend of our site creating content and when they go to save a story it throws the 521 error and their work is lost.

I am not sure how to troubleshoot or handle this type of situation. I have reached out to our hosting company numerous times who looks into this issue and reports that our database is functioning fine. So I wanted to reach out to the community here to see if anyone can offer assistance and what the best tricks are going forward where hopefully I can correct this going forward.


Thanks in advance!

That wouldn’t be a database error. It’s often a firewall at the host.


If its a firewall issue at the host what steps can I take to resolve this @sdayman and what can I tell the end-user to try to resolve the issue on their end?

This has nothing to do with your end users. Allow / whitelist the net ranges below for port 80 and 443 and check the webserver configuration.

1 Like


I should have the web hosting company do this on their end and nothing here on Cloudflare correct? I have multiple people reporting the 521 error when they create, save, and when we publish content. I did have the Cloudflare WAF turned on but disabled yesterday to see if it would help but no difference happened. Lastly, our hosting provider updated the time to respond on the PHP yesterday from 10 secs to 90 secs and this seemed to again make no difference.

This is not caused by any setting in your Cloudflare account. Pause Cloudflare and check how long it takes to save new content, timeout on Cloudflare’s end is 100s.

Probably your host has security settings in place as well. Rate limitings for example.

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.