521 Web Server Is Down

Cloudflare tried to connect to the origin server and the connection was refused.

Last updated . How this page is checked.

Status code521
Status textWeb Server Is Down
Category5xx Server Error
Response has bodyUsually
Defined byCloudflare (not an IANA-registered code)

What does 521 Web Server Is Down mean?

Cloudflare tried to connect to the origin server and the connection was refused. It is numbered in the 5xx Server Error range but is not a registered HTTP status code, so the general meaning of that class is only a rough guide to it.

When do APIs return 521?

On sites behind Cloudflare, when nothing is accepting connections on the origin's web port. Either the web server process is stopped, or a firewall on the origin is rejecting Cloudflare's IP addresses.

How to fix a 521 Web Server Is Down

Confirm the web server is running and listening on the port Cloudflare connects to. Then check the origin's firewall and any security software for rules that block Cloudflare's published IP ranges; rate-limiting tools often ban them by mistake, because every visitor appears to come from the same few addresses.

Reproduce a 521 response

The fastest way to understand a status code is to trigger one and read the full response. Open the API tester and send a request to https://httpbin.org/status/521 — you will see the 521 status along with every response header the server sent. Comparing those headers against a working request is often what reveals the cause.

That response only imitates the number, which is useful for checking how your own client, alerting or retry logic treats a 521. A real one comes from the software named in the table above, in the circumstances this page describes.

When you are debugging a real endpoint, check the response headers as carefully as the body, and confirm you are using the right HTTP method for the operation.

Related 5xx status codes

See also

References