Free auditStart free
GuideError · CDN and hosting

Cloudflare 504 Gateway Timeout

A Cloudflare 504 comes from your origin, from Cloudflare, or from harmless Early Hints cache misses. Tell them apart and know when it is really a 524.

5 min
read
8
sources
Oct 21, 2026
updated
Scaplet Editorial Team
author
In one line

A Cloudflare 504 Gateway Timeout comes from your origin web server (the most common source) or from Cloudflare itself. A Cloudflare-branded 504 means your origin returned that status; a blank, unbranded one came from Cloudflare. Some 504s in logs are harmless Early Hints or Workers cache misses. If Cloudflare connected but got no response in time, you would see 524 instead.

30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
02How it works

How to get past a 504 as a visitor

Cloudflare says that when most 5xx errors appear, the right first step is to contact the hosting provider or site administrator, and that Cloudflare Support only assists the domain owner. As a visitor you can do little beyond waiting and ruling out your own setup.
  1. 1

    Reload after a minute

    If the origin was slow for a moment, a reload may work. Cloudflare says that when a data center gets a sudden increase in traffic, automated processes redirect traffic to another one in a few seconds, and some clients may see temporary latency or 502 errors meanwhile.

  2. 2

    Try another network or device

    If the page loads on mobile data or on someone else's connection, the problem is local. If it fails everywhere, the site has the fault.

  3. 3

    Tell the site owner

    Send the exact URL, the time with your timezone and the error code. Cloudflare lists those details for owners to give a hosting provider. Add the Ray ID if the error page shows one, since Cloudflare's log tools can filter by it.

04How it works

What to check and what to send Cloudflare

  1. 1

    Look at the error page

    Branded means the origin sent it. Blank means Cloudflare did.

  2. 2

    Test the origin without Cloudflare

    Cloudflare's error 520 guidance suggests setting the affected DNS record to DNS-only or temporarily pausing Cloudflare as a workaround while you troubleshoot. That also shows whether the origin fails on its own.

  3. 3

    Check logs between Cloudflare and origin

    Cloudflare says the cause is not always in the origin's error logs. Check load balancers, caches, proxies and firewalls too.

  4. 4

    Disable compression at the origin

    An origin that serves gzip content without updating content-length, or broken gzip, can produce an unbranded error.

Origin timing check
curl -sS -o /dev/null -w 'status=%{http_code} connect=%{time_connect}s total=%{time_total}s\n' \
  https://ORIGIN_IP/ -H 'Host: example.com' -k

For a support ticket Cloudflare asks for the timestamp with timezone, the URL that returned the error, and the output of <YOUR_DOMAIN>/cdn-cgi/trace.

05Explained

What it does to SEO

Google treats 5xx responses as server errors: its crawlers slow down, content returned with them is ignored, and URLs already indexed are kept for a while but eventually dropped if the errors persist. Genuine 504s are 5xx errors to crawlers. See 5xx server errors for how to trace the pattern and confirm recovery, and Google's documentation on how HTTP status codes affect its crawlers.
Questions

Asked a lot.

4 questions people ask next, answered from the sources on this page.

01How do I fix a 504 error on Cloudflare?

Find out whether your origin or Cloudflare sent it by looking at the error page. For an origin 504, check load, crashes and network failures at the origin. For an unbranded one, test disabling compression at the origin.

02Is a 504 error my fault?

Usually not, if you are a visitor. Cloudflare tells visitors to report 5xx problems to the site owner. Owners should start with the origin web server.

03Will a 504 gateway timeout fix itself?

Sometimes. Cloudflare says a brief traffic shift between its data centers can cause temporary latency or 502s. A 504 from a crashed or overloaded origin lasts until the origin is fixed.

04Why do I see many 504s in Cloudflare logs when the site works?

Cloudflare says an influx of 504 responses with a request source of earlyHintsCache is expected and benign when Early Hints is enabled. They are internal subrequests for cached Early Hints, not end user requests.

Sources · 8

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • cloudflare.com
  • google.com
  1. 01Error 502 or 504 - Cloudflare Support docsdevelopers.cloudflare.com · checked 2026-10-25
  2. 02Error 520 - Cloudflare Support docsdevelopers.cloudflare.com · checked 2026-10-25
  3. 03Error 524 - Cloudflare Support docsdevelopers.cloudflare.com · checked 2026-10-25
  4. 04Error 522 - Cloudflare Support docsdevelopers.cloudflare.com · checked 2026-10-25
  5. 05Cloudflare 5xx errors - Cloudflare Support docsdevelopers.cloudflare.com · checked 2026-10-25
  6. 06How HTTP status codes affect Google's crawlersdevelopers.google.com · checked 2026-10-25
  7. 07Early Hints - Cloudflare Cache docsdevelopers.cloudflare.com · checked 2026-10-25
  8. 08Cache API - Cloudflare Workers docsdevelopers.cloudflare.com · checked 2026-10-25
Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane