HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

521 Web Server Is Down

Fault: Server
TL;DR

A Cloudflare-specific code: the origin actively refused the connection or is offline.

Cloudflare cannot establish a connection to the origin web server.

What HTTP 521 Web Server Is Down Means

Cloudflare cannot establish a connection to the origin web server.

A Cloudflare-specific code: the origin actively refused the connection or is offline.

Common Causes

How to Fix It (For Visitors)

How to Fix It (For Developers/Admins)

Returning a 521 Web Server Is Down (Code Examples)

If you build APIs or web apps, here is how to send an HTTP 521 response and how to test for it:

Node.js (Express)

app.get('/resource', (req, res) => {
  res.status(521).json({ error: 'Web Server Is Down' });
});

Python (Flask)

@app.route('/resource')
def resource():
    return jsonify(error='Web Server Is Down'), 521

PHP

<?php
http_response_code(521);
header('Content-Type: application/json');
echo json_encode(['error' => 'Web Server Is Down']);

Check the status with curl

curl -I https://example.com/resource
# Look for: HTTP/1.1 521 Web Server Is Down

Frequently Asked Questions

What does HTTP 521 Web Server Is Down mean?

A Cloudflare-specific code: the origin actively refused the connection or is offline. In short: Cloudflare cannot establish a connection to the origin web server.

Is a 521 Web Server Is Down error my fault or the website's?

521 is a 5xx server-error code, so the problem is on the server side, not your browser or device. As a visitor you can usually only retry; if you run the site, investigate the server.

How do I fix a 521 Web Server Is Down error?

Start/restart the origin web server. Allow Cloudflare IP ranges in the firewall. Verify the origin DNS/IP is correct.

Official Specification

The 521 Web Server Is Down status code is defined in Cloudflare (non-standard).

View the IANA HTTP Status Code Registry →