Origin web server application is offline
- What is happening
- Nothing is running or listening where Cloudflare connects
- Who can fix it
- Site owner or host
Cloudflare error 521 means the origin server refused Cloudflare's connection. See the two common causes, how to confirm each and what to change.
Cloudflare error 521 means the origin web server refused the connection from Cloudflare. It is a Cloudflare-defined status, not a standard HTTP one. The two usual causes are an origin web server application that is offline and an origin firewall that blocks Cloudflare's IP addresses. Visitors cannot fix it; the site owner or host has to.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
Cloudflare notes that security solutions at the origin may block legitimate connections from certain Cloudflare IP addresses. Cloudflare explains that all visitor traffic reaches your origin from shared Cloudflare IP addresses, which to a firewall can look like a few sources sending high volume and may trigger automatic blocking or rate limiting. A 521 is not aimed at you as a visitor. It is Cloudflare reporting that your origin would not accept its connection.
A reload costs nothing and may work if the origin was briefly down. A 521 that persists needs the owner to act.
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.
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.
Check that the web server process is up and review its error logs for crashes or outages.
Cloudflare says to allow all of its IP ranges in the origin's firewall or other security software, and to confirm they are not blocked or rate limited. The ranges are published on its IP addresses page.
The origin application must be bound and listening on port 80 for Flexible, or port 443 for Full and Full (strict).
In Full or Full (strict) mode the origin must support HTTPS, with a Cloudflare Origin Certificate or a certificate that meets the mode's requirements.
# On the origin host: is anything bound to 80 or 443?
ss -tlnp | grep -E ':(80|443)\b'
# From another machine, test the origin IP directly
curl -sSI --max-time 10 https://ORIGIN_IP/ -H 'Host: example.com' -k# Run once per range listed at https://www.cloudflare.com/ips (replace $ip)
# IPv4
iptables -I INPUT -p tcp -m multiport --dports http,https -s $ip -j ACCEPT
# IPv6
ip6tables -I INPUT -p tcp -m multiport --dports http,https -s $ip -j ACCEPT| Cause | Where to look | Fix |
|---|---|---|
| Web server not running | Process status, web server error log | Start it, fix the crash, add monitoring |
| Wrong port for the SSL/TLS mode | Listening ports, Cloudflare SSL/TLS overview | Listen on 80 (Flexible) or 443 (Full, Full strict), or change the mode |
| Cloudflare IPs blocked | Origin firewall, host security tools, rate limit rules | Allow all published Cloudflare IP ranges |
| No HTTPS at origin in a Full mode | Origin certificate setup | Install a Cloudflare Origin Certificate or a valid certificate |
Cloudflare can also show 521 neighbours that look similar. A 522 connection timed out means the origin did not answer in time, rather than refusing, and a 525 SSL handshake failure means the connection opened but TLS failed. A plain 502 with Cloudflare branding means your origin itself sent that status.
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. A 521 on a page Google crawls is a 5xx from its point of view, so fix it quickly. 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.
4 questions people ask next, answered from the sources on this page.
It is a Cloudflare-specific status meaning the origin web server refused the connection from Cloudflare. It is not defined in the HTTP standard; Cloudflare's documentation defines it.
Make sure the origin web server is running, allow all Cloudflare IP ranges in the origin firewall, and confirm the server listens on the port your SSL/TLS mode needs: 80 for Flexible, 443 for Full and Full (strict).
No. The refusal happens between Cloudflare and the site's origin server. Cloudflare says site visitors should report the problem to the site owner.
A 521 means the origin refused Cloudflare's connection. A 522 means Cloudflare timed out contacting the origin, either before the TCP connection was set up or while waiting for acknowledgment of its request.
Run the free audit, then approve the fixes. Every change can be undone.