Error 522: Connection timed out
Cloudflare couldn’t open a connection to the server behind your site in time, so it showed its own error page in place of your app.
Also appears as
- error code: 522
Prompt to fix it
My site behind Cloudflare shows "Error 522: Connection timed out". Help me find why Cloudflare can’t reach the origin. Check the repo for how the app is deployed and which host serves it, list the DNS records that host expects, and walk me through comparing them with my Cloudflare DNS records. If this is a Cloudflare Worker, look for fetch calls to its own hostname. Tell me whether to keep Cloudflare’s proxy on for this host. Don’t suggest turning off SSL or opening the firewall to everyone.
Paste into Layerwise or any AI coding tool.
What it means
When a domain runs through Cloudflare’s proxy (the orange cloud), visitors connect to Cloudflare, and Cloudflare connects to your server, called the origin. Error 522 means that second connection timed out: the origin didn’t answer Cloudflare within 19 seconds, or it connected and then never acknowledged the request within 90 seconds.
Cloudflare itself is working, and the page shows which side failed. The usual problem is the address Cloudflare is trying: an old IP in a DNS record, a server that’s down, or a firewall that drops Cloudflare’s traffic.
If the app lives on Vercel or Netlify, you may not need the proxy at all. Those hosts handle HTTPS and caching themselves, and they recommend pointing DNS straight at them with the record set to DNS only (the grey cloud).
Common causes
- A proxied DNS record still points to an old server IP after the app moved hosts.
- The origin server is down, overloaded, or its firewall blocks or rate-limits Cloudflare’s IP addresses.
- A Cloudflare Pages site got a CNAME record for a custom domain that was never added to the Pages project.
- A Worker on a Custom Domain calls
fetchon its own hostname.
How to fix it
- In the Cloudflare dashboard, open DNS → Records and check that each proxied
A,AAAA, orCNAMErecord points to the address your host gives you today. - Open the origin directly, such as
my-app.vercel.appor the server’s IP, to confirm the app is up. - If you run the server, allow Cloudflare’s IP ranges in its firewall and check its load.
- For Cloudflare Pages, add the domain under Custom domains in the Pages project, then point the CNAME at the project’s
pages.devaddress. - For a site on Vercel or Netlify, consider switching the record to DNS only so visitors connect to the host directly.
Related errors
All errorsError 1101: Worker threw exception
Your Cloudflare Worker hit a JavaScript error while handling the request, so Cloudflare showed its error page in place of a response.
ERR_TOO_MANY_REDIRECTS
The site keeps redirecting the browser in a circle, usually between HTTP and HTTPS or between two domains, so the browser stops trying.
DNS_PROBE_FINISHED_NXDOMAIN
The browser asked DNS where your domain lives and was told the name doesn’t exist, usually because a record is missing or still spreading.
NET::ERR_CERT_COMMON_NAME_INVALID
The site’s security certificate was issued for a different domain name, so the browser can’t confirm it’s really your site.
Build with an agent that checks its work
The Layerwise agent clicks through the live preview and reads the console, so it catches errors before you do.