520 Error (Elementor)

Elementor 520 Error: Causes and Fixes

The 520 error usually occurs when using Cloudflare and means the origin server returned an unexpected or invalid response. On WordPress sites built with Elementor, it can appear while editing or browsing pages.

What Is a 520 Error?

It’s an Unknown Error returned by Cloudflare when it receives an invalid HTTP header or body from the origin server, or when the HTTP connection ends unexpectedly.

Common Causes Related to Elementor and WordPress

Invalid HTTP headers: Extra spaces or line breaks before output from a theme or plugin.

Hidden PHP errors: Warnings or notices that appear before headers are sent, corrupting the response.

Server resource limits: Memory exhaustion or stuck PHP processes leading to incomplete replies.

Firewall or WAF rules: Blocking admin-ajax.php or REST API calls used by Elementor.

SSL/TLS mismatch: Cloudflare set to Full Strict while the origin has an invalid certificate.

Cache or compression issues: Double GZIP or invalid compression from plugins.

Quick Diagnostics

Disable Cloudflare temporarily: Use Development Mode or access the origin IP directly.

Check error logs: Inspect PHP-FPM, Nginx, or Apache logs for errors at the time of the 520 response.

Test a default page: Create a plain WordPress page without Elementor to isolate the problem.

Fix Steps in Order

Clear all caches: Plugin, server (Varnish), and Cloudflare caches.

Disable plugins causing premature output: Turn off security, analytics, caching, and minification plugins, then re-enable one by one.

Remove early output: Eliminate any echo, print, or var_dump before wp_head in functions.php or plugin files.

Increase PHP limits: Set memory_limit 256M–512M and max_execution_time 300 for testing.

Fix .htaccess or Nginx config: Restore default WordPress rewrite rules and prevent double compression.

Align SSL settings: Use “Full” mode with a valid certificate, or “Full Strict” with a valid origin certificate.

Allow Elementor requests: Whitelist admin-ajax.php and /wp-json endpoints in firewalls or WAF.

Recommended Settings During Editing

WordPress: WP_MEMORY_LIMIT of at least 256M and disable the Heartbeat API on the frontend.

Nginx/Apache: client_max_body_size ≥ 64M and read timeouts up to 300 seconds for debugging.

Cloudflare: Disable Rocket Loader temporarily and avoid double minification with cache plugins.

Elementor Editing Problems Related to 520

admin-ajax.php fails randomly: Increase server timeouts and relax overly strict WAF rules.

Large images or files: Compress and optimize media, disable aggressive minification during uploads.

Prevention and Best Practices

Keep everything updated: Elementor, plugins, and PHP versions should be current.

Monitor logs: Track PHP errors and warnings to prevent invalid output.

Use staging for tests: Edit and test Elementor on a staging environment before deploying live with Cloudflare.

Summary

The 520 error in Elementor usually stems from invalid responses, PHP errors, or WAF restrictions when using Cloudflare. Clear caches, disable conflicting plugins, review logs, and align SSL and timeout settings. If the issue persists, coordinate with your hosting provider to trace requests between Cloudflare and the origin server.

Was this answer helpful?

0 Users Found This Useful