Free test available for France , UK or SG on Telegram Join Telegram •
HTTP Errors

522 Error: What It Means and How to Fix It

A 522 happens when Cloudflare can’t connect to the website’s server in time. Your browser reached Cloudflare just fine — here’s how to check whether it’s just you, and how site owners fix it.

PXM2 Proxies November 29, 2026 11 min read
522 Connection timed out
19 s Cloudflare’s handshake limit
90 s Wait for first data
7+ Countries available
  • Where it breaks — between Cloudflare and the origin server, not between you and Cloudflare.
  • Cloudflare’s exact timeouts — 19 seconds for the TCP handshake, 90 seconds for the first data.
  • Reproduced on a real server — a refused port versus a firewall that silently drops the handshake.
  • A regional check — read the colo code and compare from a second location to see whether the 522 is regional.
4G / 5G Mobile Proxies Second Location
Protocol supportHTTP(S), SOCKS5
Session typeRotating or sticky
BandwidthUnlimited
HardwareDedicated 4G/5G modem
A Different Data Center

Exit from another country and Cloudflare reaches the origin from another colo.

Regional or Global?

If the 522 follows you everywhere, the origin is down and no proxy will help.

A 522 error happens when Cloudflare tries to connect to the website’s server but doesn’t get a response in time. Your browser connects to Cloudflare just fine. The issue is between Cloudflare and the website’s server, also called the origin.

This means a 522 error is almost always something the site owner needs to fix. If you’re visiting, you usually have to wait, but you can quickly check whether the problem is with the site or your connection.

Cloudflare’s documentation page for error 522: connection timed out
Cloudflare’s own definition: error 522 “occurs when Cloudflare times out contacting the origin web server”.

Quick Answer

Error 522
Sent byCloudflare
NameConnection timed out
Standard HTTP code?No, it’s Cloudflare’s own
Usual causeThe origin’s firewall blocks Cloudflare, or the server is down or overloaded
Your fault?Almost never
First fixWait a few minutes and reload

What Error 522 Means

Every site behind Cloudflare has two connections in the path. Your browser connects to Cloudflare. Cloudflare then opens its own connection to the site’s server to fetch the page.

A 522 error occurs when that second connection doesn’t start. Cloudflare’s documentation says this means Cloudflare timed out while trying to reach the origin web server, and it lists the exact time limits:

  • Before the connection exists: Cloudflare sends a connection request (a TCP SYN) and waits 19 seconds for the server to answer (a SYN+ACK), retrying after 1, 1, 1, 1, 1, 2, 4, and 8 seconds.
  • After the connection exists: Cloudflare waits 90 seconds for the server to send anything above the TCP layer, such as the first step of the TLS handshake.

If either time limit runs out, you’ll see a 522 error.

You can see what Cloudflare sees with a small test. Below, the same tiny web server is reached three ways: with nothing listening, with a firewall rule that silently drops new connections, and with the rule removed.

Real terminal output: curl to a closed port fails instantly with error 7, curl to a firewalled port times out after 5002 ms with error 28, and after removing the iptables DROP rule the same server returns 200
Here’s a real test on a local server. If the port is closed, the connection is refused instantly, which Cloudflare reports as a 521 error. If a firewall drops the handshake, the request hangs until it times out. That’s what Cloudflare shows as a 522 error.

That’s why firewalls often cause 522 errors. If a firewall rejects a connection, you get a quick, clear response. If it silently drops the connection, there’s no response at all.

What Causes Cloudflare Error 522

Cloudflare lists five common causes:

  1. Cloudflare’s IP addresses are blocked or rate-limited at the origin, in .htaccess, iptables, or a firewall. This is the most common one.
  2. The origin is overloaded or offline and drops new connections.
  3. KeepAlive is turned off on the origin web server.
  4. The DNS record points to the wrong IP. The origin IP in Cloudflare doesn’t match the server the host actually assigned.
  5. Packets are being dropped somewhere at the origin’s network.

A few setups have their own versions of the problem:

  • Cloudflare Pages: the site needs a custom domain set up, and the CNAME must point to the custom Pages domain.
  • Workers on a Custom Domain: a Worker that calls fetch on its own hostname gets a 522.
  • Origin Rules: if a rule sends traffic to a hostname that resolves to a reserved address (such as 192.0.2.0 or 100::), you get a 522.

Is It Just You?

First, make sure the error is really coming from Cloudflare. Run this against the site (here it’s a live Cloudflare site that’s working normally):

Real terminal output: curl to registry.yarnpkg.com returns 200 with server: cloudflare and a cf-ray ID ending in IAD
A healthy site returns 200. On a 522, the first line would read 522, with the same server: cloudflare header. Save the cf-ray value: the site owner needs it to find your request.
Terminal · is it Cloudflare?
URL="https://your-site.example/"
curl -s -o /dev/null -w "%{http_code}\n" "$URL"
curl -s -o /dev/null -D - "$URL" | grep -iE "^(server|cf-ray)"

Next, see if the error changes depending on where you connect from. This is especially important for 522 errors, since Cloudflare usually connects to the origin from the data center closest to you. If the origin’s firewall blocks only some Cloudflare IP ranges, or if there’s a routing problem from one data center, people in one area might get 522 errors while others can load the page without issues.

Add /cdn-cgi/trace to the site’s address to see which data center you’re using. The colo line is a three-letter airport code (IAD is Washington, AMS is Amsterdam). Then load the page from another network or another country and compare:

  • Fails everywhere: the origin is down or blocking Cloudflare as a whole. Only the owner can fix it.
  • Fails from one data center only: it’s a regional block or routing problem between that Cloudflare location and the origin. Report it to the owner with both colo codes and your cf-ray.
  • Works from another network in the same region: the problem was temporary. Reload on your own connection.

If You’re Browsing

  1. Wait a few minutes and reload.

    Overloaded servers often recover on their own.

  2. Try another network.

    Use something like your phone on mobile data. If it loads there, see the section above.

  3. Report it with the Ray ID.

    Send the site a screenshot of the error page, including the Ray ID at the bottom and the time.

Clearing your cache, flushing DNS, or switching browsers won’t fix this. Your browser already connected to Cloudflare. The problem is further along the path.

Seeing “error code 522” on Roblox? That’s a different error with the same number. Roblox uses its own codes, and 522 there usually means the player you’re trying to join has left the game. Try joining again or pick another server.

Seeing it on a web app like Blooket? If the page shows Cloudflare’s error screen with the You, Cloudflare, and Host icons, it’s the 522 described here. The app’s servers aren’t answering, so wait and check its official status or social accounts for updates.

If You Run Scripts

A scraper or monitor can hit 522s even when the site looks fine in your browser.

You can try again, but don’t keep retrying endlessly. A 522 error usually means the origin server is having trouble. Sending too many requests can make things worse. Wait longer between each attempt:

Python · retry with backoff
import time
import requests

def get_with_backoff(url, proxies=None, tries=3):
    for attempt in range(1, tries + 1):
        resp = requests.get(url, proxies=proxies, timeout=120)
        if resp.status_code != 522:
            return resp
        print(f"522 on attempt {attempt}, cf-ray {resp.headers.get('cf-ray', 'n/a')}")
        if attempt < tries:
            time.sleep(10 * attempt)  # 10s, then 20s
    return resp

Set your own timeout above Cloudflare’s. Cloudflare can take up to 19 seconds to give up on the connection, and up to 90 seconds once it’s connected, so a 10-second client timeout will hide the 522 and show you a generic timeout instead.

Pay attention to how many requests you send at once. If you see a lot of 522 errors when you increase your traffic, your requests might be overloading the origin server. Try reducing the number of parallel requests and spreading them out over time.

Check whether it’s regional. Because the 522 depends on which Cloudflare data center handles your request, a script running from one country can fail while the same script elsewhere works. Run the same request through a clean IP in another location:

Terminal · direct vs. another location
export PROXY="http://USERNAME:PASSWORD@uk1.pxm2.io:PORT"
curl -s -o /dev/null -w "direct: %{http_code}\n" "$URL"
curl -s -o /dev/null -w "proxy:  %{http_code}\n" -x "$PROXY" "$URL"
curl -s -x "$PROXY" "${URL%/}/cdn-cgi/trace" | grep colo

If the direct request returns 522 and the proxied one returns 200, the fault sits on the path from your region’s data center to the origin. If both return 522, the origin is down, and no proxy will help.

No matter what, only collect public data, respect the site’s terms of use, and stop if the server is clearly having trouble. For pacing that avoids overloading a target in the first place, see web scraping best practices.

If You Own the Site

To fix this, you’ll need to check your origin server or your DNS settings.

  1. Allow all of Cloudflare’s IP ranges.

    Check your firewall, iptables, .htaccess, security plugins, and your host’s own firewall. Cloudflare publishes the current ranges at cloudflare.com/ips. If you want to block countries, do it with a WAF custom rule in Cloudflare, not at the origin.

  2. Make sure your server is running and has enough resources.

    Check CPU, memory, and connection limits when the errors happen.

  3. Turn on KeepAlive

    Enable it in your web server.

  4. Check your DNS records against your hosting provider.

    The A or AAAA record in Cloudflare should match your server’s current IP address. Using an old IP after a migration is a common cause of 522 errors.

  5. Test your origin server directly.

    From another computer, run curl -v --resolve your-site.example:443:ORIGIN_IP https://your-site.example/. If the command hangs, the issue is with your server or its firewall, not Cloudflare.

Find the 522s in Your Data

Open Origin Analytics and check the TCP failure rate. If it’s high for specific paths in the Top endpoints table, the problem is tied to those paths rather than the whole server.

If you can’t find the cause, ask your host to run an MTR or traceroute from the origin to a Cloudflare IP that appears in your server logs, and send their findings to Cloudflare Support with the URL, the cf-ray, and the time of the error.

Error 522 vs. Other 5xx Errors

Error Cloudflare’s name What happened
520Web server returns an unknown errorOrigin replied with nothing usable
521Web server is downOrigin refused the connection
522Connection timed outOrigin never accepted the connection in time
523Origin is unreachableCloudflare can’t route to the origin
524A timeout occurredOrigin connected but took too long to send the page
525SSL handshake failedSecure connection to the origin failed

It’s easy to confuse 522 and 524 errors. A 522 means the connection never started. A 524 means the connection worked, but the page took too long to load. If you’re blocked or rate-limited instead, you’ll see a 1xxx error like 1005, 1015, or 1020 — our guide to common scraping blocks covers those, and a 406 from the site’s own firewall is explained in what a 406 error means.

Test From Another Location Yourself

Live PXM2 locations — real 4G and 5G carrier IPs in other countries, so you can see whether a 522 is regional. Ask support for a free 1-hour trial and run the test on your own target:

🇫🇷

France

4 Operators 20-100 Mbps
Starting from
$4.34 for 1 hour
4G
Available Operators:
Orange Bouygues SFR Free Mobile
🇮🇳

India

1 Operator 20-30 Mbps
Starting from
$2.74 for 1 hour
4G
Available Operators:
Airtel
🇵🇱

Poland

1 Operator 20-80 Mbps
Starting from
$3.99 for 1 hour
4G
Available Operators:
Play
View all locations →

Frequently Asked Questions

What does error code 522 mean?

Cloudflare error code 522 means Cloudflare couldn’t connect to the website’s server in time. The issue is with the website, not your device.

Is a 522 error my fault?

Rarely. Your browser connected to Cloudflare without problems. The failure happens between Cloudflare and the website’s server.

How long does error 522 last?

If the server is just overloaded, it might recover in a few minutes. But if a firewall is blocking Cloudflare, 522 errors will keep happening until the owner fixes the firewall settings.

Is HTTP error 522 a real status code?

It’s not a standard status code. Cloudflare made it to show when its connection to the origin server times out.

Can a VPN or proxy fix error 522?

A VPN or proxy only helps if the 522 error is regional, meaning just one Cloudflare data center can’t reach the origin. Connecting from somewhere else uses a different data center. If the origin is down everywhere, a VPN or proxy won’t help.

Can error 522 hurt SEO?

A short outage won’t hurt your SEO. Google slows down crawling when it sees 5xx errors but keeps your pages indexed for a while. If 522 errors last for days, Google may start removing those pages.

What’s the difference between a 521 error and a 522 error?

A 521 error means the origin server refused the connection, often because the web server isn’t running. A 522 error means the origin didn’t respond at all, usually because a firewall dropped the request or the server was too busy.

Once you know whether a 522 is regional or global, the rest of the cluster covers building a scraper that copes with it.

Web scraping guides

Core mobile proxy guides

Find Out Whether the 522 Is Regional

Real 4G/5G carrier IPs in other countries — run the same request from a second location. Ask support for a free 1-hour trial.

Try a Clean Carrier IP

Sources: Cloudflare Docs: Error 522 · Cloudflare Docs: 5xx errors · Cloudflare IP ranges · Google: How HTTP status codes affect Google’s crawlers