Disable WP-ADMIN from Cloudflare

Hi, I am getting a lot of 520 errors when creating products and coupons in my WordPress admin backend.

In my browser network tab /wp-admin/post.php and /wp-admin/admin-ajax.php return a 520.

There are no errors in the server logs.

These errors go away only when I pause Cloudflare from the site.

I tried adding the following Page Rule, however it did not work:

Page Rule URL: *domain.com/wp-admin/*

Disable Security

Security is disabled

Browser Integrity Check - Off

Server Side Excludes - Off

Always Online - Off

Security Level - Essentially Off

Cache Level - Bypass

Cache Deception Armor - Off

Origin Cache Control - Off

Disable Apps - Apps are disabled

Disable Performance - Performance is disabled

Any idea how we can prevent these errors?

Typically, 520 errors are related to slowness at the origin. While your browser may wait a bit longer than Cloudflare (hence the problem seemingly going away when you pause Cloudflare), Cloudflare has a limit of how long it waits for the origin to respond.

Some of the settings you’ve set on your page rule can actually make things worse. For instance, you should not bypass cache on the /wp-admin/ directory, as it has many JS and CSS files that are cached by Cloudflare by default and need not be requested every time to the origin. I’d just keep Disable Apps, Disable Performance, but increase security level to either normal or high. These settings have little bearings on the origin performance.

In my WordPress installations, I got rid of similar issues by changing a few plugins that were too resource-intensive. I’d suggest you try to measure the performance of your plugin with the P3 plugin, then perhaps finding substitutes for any plugins that might be reasonably expected to cause this.

Another suggestion is that you open your WordPress panel with Developer Tools open (F12 on Chrome/Windows). Some themes and plugins will load unnecessary JS files even when you are not in their admin pages, which can cause slowness for no good reason. If that is the case, you might want to contact the theme or plugin author directly to discuss your findings.

A 520 error occurs when the connection started on the origin web server, but that the request was not completed. The most common reason why this would occur is that either a program, cron job, or resource is taking up more resources than it should causing the server not to be able to respond to all requests properly.

Review the Quick Fix Ideas in this Community Tip for troubleshooting suggestions.

Thanks for your reply @floripare!

The website is optimized and is not slow.

This only happens when saving a post, adding a product or coupon, etc.

On regular page loads it is fine. Even on slow loading pagesvin the backend e.g. an orders page.

It only happens when doing one of the actions that trigger wp_ajax.php or post.php

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.