Skip to content
Log In Sign Up info@muvcloud.com

What Error 524 Means

With a proxied site, the edge opens a connection to your origin, sends the request, and waits for the response headers. If none arrive within its proxy read timeout, a fixed limit that Cloudflare currently documents as 125 seconds by default, it gives up and shows error 524. The TCP connection worked, so this is not error 522; the application was too slow.

If You See It on Someone Else's Site

  • Do not resend a form right away: the server may have finished the action after the page gave up, for example a payment or an order.
  • Reload after a minute: a 524 on a busy page often clears once load drops.
  • Tell the site owner which action caused it; one slow page is easier to fix than a vague report.

Find the Slow Requests

Add timing to the Nginx access log. In the http block:

log_format timed '$remote_addr [$time_local] "$request" $status '
                 '$request_time $upstream_response_time';
access_log /var/log/nginx/timed.log timed;

Test with sudo nginx -t, reload, and list requests that took longer than 60 seconds:

awk '$(NF-1) > 60' /var/log/nginx/timed.log | tail

In Apache, %D in a LogFormat line records the time per request in microseconds. The PHP-FPM slow log, enabled with request_slowlog_timeout and slowlog in the pool file, shows where in the code a slow script was.

Origin Timeouts Come First

Nginx's fastcgi_read_timeout and proxy_read_timeout default to 60 seconds between two reads from the backend, so a PHP request that stays silent that long normally ends with a 504 from your own server before the edge's limit. A 524 often means these values, or PHP's max_execution_time, were raised above the edge's timeout. Raising them further does not help: the edge stops waiting at its own limit regardless.

Slow Database Queries

Turn on the MySQL or MariaDB slow query log for a while:

SET GLOBAL slow_query_log = 'ON';
SET GLOBAL long_query_time = 2;
SHOW VARIABLES LIKE 'slow_query_log_file';

These settings last until the database restarts; put them in the server's configuration file to keep them. Run EXPLAIN on the queries the log shows, and add the index they are missing. SHOW FULL PROCESSLIST; lists queries running right now.

Move Long Work to the Background

Exports, imports, report generation, and bulk mail do not belong in a web request. Let the request create a job and return at once; a queue worker, a cron job, or a systemd service does the work, and the page checks the job's status. The visitor gets an answer in seconds, and the job is not cut off by any proxy.

An Unproxied Subdomain for Long Tasks

For admin tasks that must run long in the browser, create a subdomain such as admin.example.com and set its DNS record to DNS only in Cloudflare. Requests then go straight to your server and only its own timeouts apply. The record reveals the origin's IP address, so restrict that subdomain to known addresses with allow and deny rules, and give it its own certificate.

Confirm the Fix

curl -s -o /dev/null -w '%{http_code} %{time_total}\n' https://example.com/report

The output shows the status and the total time in seconds. Expect 200 and a time well below the limit. If requests are slow because the server is short of workers, see 503 Service Unavailable; for the other codes, see HTTP status codes explained.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations