---
title: "Cloudflare Error 522 on Nginx: cause and fix"
description: "Nginx stops accepting connections once worker_connections is exhausted, which Cloudflare sees as a refused handshake rather than a slow page."
canonical: "https://lemwatch.com/errors/cloudflare-522/in-nginx"
source: "https://lemwatch.com"
---

# Cloudflare Error 522 on Nginx

> Nginx stops accepting connections once worker_connections is exhausted, which Cloudflare sees as a refused handshake rather than a slow page.

## Why it happens on Nginx

 Nginx stops accepting connections once worker_connections is exhausted, which Cloudflare sees as a refused handshake rather than a slow page.

## The fix on Nginx

 Raise worker_connections and worker_processes, confirm the box is not out of file descriptors (ulimit -n), and check that ufw or the cloud firewall allows 443 from Cloudflare's ranges.

## If that didn't fix it

 Nginx has its own failure mode, but Cloudflare Error 522 has a wider set of causes. The most common one overall is: The origin firewall silently drops Cloudflare's IP ranges.

 Allowlist Cloudflare's IP ranges with an accept rule, and make sure the default policy does not drop them earlier in the chain.

## Check your own domain

 Probing the origin address directly shows whether it is reachable from outside Cloudflare, which immediately tells you whether the fault is the firewall or the host.

## Frequently asked questions

### Why does Cloudflare Error 522 happen on Nginx?

 Nginx stops accepting connections once worker_connections is exhausted, which Cloudflare sees as a refused handshake rather than a slow page.

### How do I fix Cloudflare Error 522 on Nginx?

 Raise worker_connections and worker_processes, confirm the box is not out of file descriptors (ulimit -n), and check that ufw or the cloud firewall allows 443 from Cloudflare's ranges.

### What does Cloudflare Error 522 mean?

 Cloudflare tried to open a connection to the origin and nothing answered before the timeout. Usually a firewall silently dropping Cloudflare's traffic, an overloaded origin, or a wrong origin IP.


## Related

- [All causes of Cloudflare Error 522](https://lemwatch.com/errors/cloudflare-522)
- [All website error codes](https://lemwatch.com/errors)
- [Cloudflare Error 522 on WordPress](https://lemwatch.com/errors/cloudflare-522/in-wordpress)
- [Free Uptime & response check](https://lemwatch.com/tools/website-uptime)
- [Website monitoring overview](https://lemwatch.com/website-monitoring)
