Fix Cloudflare Error 524 Timeout in WordPress: Runbook

Diagnostic runbook to fix Cloudflare Error 524 (A timeout occurred) in WordPress. Isolate 125s Proxy Read Timeouts, log slow PHP/MariaDB queries, and tune Nginx.

Fix Cloudflare Error 524 Timeout in WordPress: Runbook
Direct Diagnostic Runbook

To fix Cloudflare Error 524 (A timeout occurred) in WordPress: Pinpoint HTTP requests exceeding Cloudflare's 125-second Proxy Read Timeout using Nginx $request_time access logs and PHP-FPM slow logs, clear locked MariaDB queries, offload heavy cron or export tasks to WP-CLI, and route unavoidable long-running admin jobs over a grey-clouded (DNS-only) subdomain.[1]

Follow this production server runbook to separate Cloudflare edge timeout ceilings from origin database deadlocks, Nginx FastCGI buffer mismatches, and blocking WordPress cron loops.[1][2]


Diagnosing Cloudflare Error 524 Timeouts on WordPress Origin Servers

HTTP Error 524 confirms that Cloudflare successfully completed the TCP handshake with your origin VPS or dedicated server and forwarded the HTTP request, but the origin acknowledged (ACK) the request without returning HTTP response headers or body bytes inside the edge proxy window.[1]

What is the exact timeout limit before Cloudflare triggers Error 524?

According to Cloudflare’s official connection limit documentation, two distinct edge timers trigger Error 524:[1][2]

  1. Proxy Read Timeout (Default 125 seconds): If your origin server fails to begin transmitting HTTP response data within 125 seconds after connection establishment, Cloudflare closes the request and serves 524 A timeout occurred.[1]
  2. Proxy Write Timeout (Fixed 30 seconds): If Cloudflare opens an upload or POST write connection to the origin and the write operation fails to finish within 30 seconds (or 6.5 seconds for Cloudflare Images), Cloudflare aborts with Error 524. This write timer cannot be modified on any plan.[1]

What is the difference between Cloudflare Error 524, 522, and 504?

HTTP Status Network Layer State Primary Failure Condition Immediate Diagnostic Focus
Error 524 TCP Connected & Request Sent Origin acknowledged request (ACK) but failed to reply within 125s read / 30s write limit.[1] PHP-FPM slow log, MariaDB locks, heavy admin-ajax.php or WooCommerce exports
Error 522 TCP SYN Dropped / Unreachable Origin failed to respond to initial TCP SYN before connection establishment. Server firewall (csf/ufw/iptables), saturated NIC, or dead web server
Error 504 Origin Reverse Proxy Timeout Origin proxy (Nginx fastcgi_read_timeout 60s default or LSAPI) timed out before Cloudflare’s 125s edge timer.[3] Upstream php-fpm worker exhaustion or upstream read timeout settings

Step-by-Step Server Runbook: How to Fix Cloudflare Error 524 in WordPress

Before adjusting web server timeouts, replicate the failing request directly against the origin server IP via SSH and enable response-time logging so you know precisely which script or SQL query stalls.

Step 1: Bypass Cloudflare Edge Locally to Measure True Origin Latency

Run curl with --resolve from an external workstation or monitoring host to query the origin directly without modifying public DNS records:

# Replace 203.0.113.25 with your actual origin IPv4 address
curl -s -o /dev/null -w "HTTP: %{http_code} | TTFB: %{time_starttransfer}s | Total: %{time_total}s\n" \
  --resolve "yourdomain.com:443:203.0.113.25" \
  "https://yourdomain.com/wp-admin/admin-ajax.php"

If direct origin latency exceeds 100 seconds (or hangs past 125 seconds), your bottleneck sits inside PHP execution, external outbound HTTP calls from WordPress (WP_Http), or MariaDB row locks.

Step 2: How do I log slow WordPress endpoints causing 524 timeouts in Nginx?

Cloudflare explicitly recommends logging per-request duration on your origin web server (ngx_http_log_module in Nginx or mod_log_config in Apache) to isolate which endpoint approaches the 125-second threshold.[1]

Add a dedicated timing format in /etc/nginx/nginx.conf inside the http {} block:[4]

log_format timed_combined '$remote_addr - $remote_user [$time_local] '
                          '"$request" $status $body_bytes_sent '
                          'rt=$request_time uct="$upstream_connect_time" '
                          'uht="$upstream_header_time" urt="$upstream_response_time"';

access_log /var/log/nginx/access_timed.log timed_combined;

Test configuration syntax, reload Nginx, and extract any URI taking more than 30 seconds:[4]

sudo nginx -t && sudo systemctl reload nginx

# Print requests exceeding 30s upstream response time
awk '$NF ~ /urt=/ { split($NF, a, "="); gsub(/"/, "", a[2]); if (a[2] > 30) print $0 }' /var/log/nginx/access_timed.log | tail -n 20

Step 3: Capture Blocking PHP Stack Traces and MariaDB Locks

Enable the PHP-FPM slow log inside your pool file (e.g., /etc/php/8.3/fpm/pool.d/www.conf) to catch hung plugins, WooCommerce webhooks, or stalled remote curl calls after 10 seconds:

slowlog = /var/log/php8.3-fpm-slow.log
request_slowlog_timeout = 10s

Reload PHP-FPM and check active MariaDB locks concurrently:

sudo systemctl reload php8.3-fpm
mysql -e "SHOW FULL PROCESSLIST;" | grep -v "Sleep"

Look for long-running Sending data, Waiting for table metadata lock, or Locked states inside wp_options, wp_postmeta, or wp_actionscheduler_actions.

Step 4: Offload Blocking WordPress Cron and Long CLI Tasks

When a heavy plugin import, WooCommerce CSV export, or mass backup runs inside an HTTP worker triggered by wp-cron.php, it traps an Apache/Nginx connection until Cloudflare’s 125s timer fires.

  1. Disable HTTP-triggered cron inside wp-config.php:
define( 'DISABLE_WP_CRON', true );
  1. Execute due WordPress cron jobs safely outside web proxies via system crontab using WP-CLI:
*/5 * * * * /usr/local/bin/wp cron event run --due-now --path=/var/www/html --quiet

Web Server and PHP-FPM Timeout Tuning (Nginx vs. LiteSpeed)

On self-managed servers, default upstream timeouts are frequently shorter than Cloudflare’s 125s read ceiling (for instance, Nginx fastcgi_read_timeout defaults to 60s).[3] Ensure origin limits are cleanly aligned so Nginx does not throw a premature 504 while still capping runaway workers cleanly.

Stack Component Configuration File & Directive Default Value Recommended Production Value
Nginx FastCGI fastcgi_read_timeout (/etc/nginx/conf.d/*.conf) 60s[3] 120s (or 300s on non-proxied admin sub-routes)
PHP-FPM Pool request_terminate_timeout (www.conf) 0 (off) 120s (matches web timeout to prevent orphan workers)
PHP Runtime max_execution_time (php.ini) 30 120 (CLI scripts remain 0 / unlimited)
LiteSpeed LSAPI External App -> Initial Request Timeout / Idle Timeout 60s / 300s 120s–300s + [E=noabort:1] for trusted exports

Do Not Rely on max_execution_time = 600 to Fix Error 524: Raising PHP's execution limit or Nginx's fastcgi_read_timeout to 600s keeps PHP workers pinned in RAM but does not bypass Cloudflare's 125-second Proxy Read Timeout on Free, Pro, or Business plans.[1] Any synchronous HTTP response taking over 125 seconds will still return Error 524 at the edge.


Cloudflare Edge Configuration and DNS-Only Bypass Rules

Can I increase the Cloudflare 524 Proxy Read Timeout without an Enterprise plan?

No. On Cloudflare Free, Pro, and Business zones, the 125-second Proxy Read Timeout is fixed.[1] Only Enterprise zones can raise proxy_read_timeout up to 6,000 seconds through a Cache Rule (Proxy Read Timeout setting on cacheable resources) or via the Zone Settings API (proxy_read_timeout).[1]

If you must run multi-minute ERP syncs, large WooCommerce imports, or admin reports without an Enterprise plan, Cloudflare officially recommends routing those specific processes through an unproxied DNS-only (grey-clouded) subdomain:[1]

  1. Create an A record in Cloudflare DNS named admin-origin.yourdomain.com pointing to your origin server IPv4 address.
  2. Toggle the proxy status icon from Orange Cloud (Proxied) to Grey Cloud (DNS Only).[1]
  3. Restrict access on that virtual host (admin-origin.yourdomain.com) in Nginx or firewall rules exclusively to your corporate office static IP or WireGuard VPN subnet so your origin IP remains protected from public attacks.

Pingora Timer Variance (+1 Second Buffer) & Origin Analytics: Cloudflare notes in its Error 524 documentation that due to its Pingora proxy architecture, an explicit proxy_read_timeout may fire 1 second early; Enterprise operators targeting 125 seconds should set 126 seconds.[1] On all plans, monitor P95 endpoint timings in Cloudflare Speed → Origin Analytics to fix slow scripts before they breach 125s.[1]

Elimination Checklist: Zero 524 Errors on Production WordPress

If high-concurrency WordPress or WooCommerce operations consistently exhaust CPU threads and trigger database queue stalls under load, bare-metal NVMe IOPS and unshared CPU cores eliminate origin wait queues at the hardware layer. Scale heavy workloads reliably with NextGen Dedicated Servers or low-latency Dedicated Servers in Pakistan.

  1. Confirm direct curl --resolve origin TTFB completes in under 2 seconds for normal frontend and admin routes.
  2. Verify Nginx access_timed.log ($upstream_response_time) contains zero unoptimized queries running past 30 seconds.[1][4]
  3. Ensure DISABLE_WP_CRON is true and heavy recurring tasks execute via WP-CLI system cron.
  4. Route unavoidable multi-minute exports through a grey-clouded IP-restricted subdomain or rewrite them using asynchronous status polling.[1]

Eliminate Origin Bottlenecks & Error 524 Timeouts

Run database-heavy WordPress and WooCommerce workloads on dedicated NVMe RAID arrays and unshared CPU cores engineered for instant origin responses.

Explore Dedicated Servers Pakistan

Disclaimer: This post is for informational and educational purposes only, accurate to the best of our knowledge at publication. It does not constitute formal consulting advice. Always test Nginx, PHP-FPM, and DNS changes in a staging environment before modifying production traffic paths.

Sources & Official References
  1. Cloudflare Docs. "Troubleshooting Cloudflare 5XX Errors — Error 524: A Timeout Occurred." Cloudflare Support Documentation, updated July 23, 2026. Available at: https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-524/
  2. Cloudflare Docs. "Connection Limits & Proxy Timeouts (Proxy Read / Proxy Write Timeout)." Cloudflare Fundamentals Reference. Available at: https://developers.cloudflare.com/fundamentals/reference/connection-limits/
  3. Nginx Documentation. "Module ngx_http_fastcgi_module — fastcgi_read_timeout Directive." nginx.org. Available at: https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_read_timeout
  4. Nginx Documentation. "Module ngx_http_log_module — log_format ($request_time) Configuration." nginx.org. Available at: https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format

Disclaimer: This post is for informational and educational purposes only, accurate to the best of our knowledge at publication. It does not constitute advice. We do not guarantee accuracy or completeness and accept no liability for any decisions or losses resulting from reliance on this content.