Troubleshooting · Troubleshooting
How to Fix Cloudflare Error 522 on WordPress
Short answer
Error 522 means Cloudflare timed out while contacting your origin server, so the fix is on the server side. First check that the origin IP in Cloudflare DNS matches your host, then ask your host to allow all Cloudflare IP ranges through the firewall. If the server is overloaded or keep-alive is off, fix that too, then reload the site to confirm it works.
Key takeaways
- Error 522 means Cloudflare timed out contacting the origin server, not that WordPress itself returned an error.
- Cloudflare waits 19 seconds for a connection reply and 90 seconds after the connection opens, as of November 2026.
- Blocked Cloudflare IP addresses are the most common cause, according to Cloudflare docs.
- A wrong origin IP in Cloudflare DNS sends Cloudflare requests to the wrong server.
- Disabled keep-alive and an overloaded origin server can also cause Error 522.
- If the site loads normally after the fix and Origin Analytics shows no TCP failures, the error is fixed.
What does Cloudflare Error 522 mean?
Error 522 means Cloudflare timed out while contacting your origin server, so visitors see a Cloudflare error page instead of your WordPress site.
Cloudflare sits between visitors and your server, which Cloudflare calls the origin. A visitor connects to Cloudflare, and Cloudflare then opens its own connection to your server to fetch the page.
Cloudflare's Error 522 page states that the error occurs when Cloudflare times out contacting the origin web server. The problem is in that second connection, not in the visitor's browser.
What are the two timeouts behind Error 522?
Two timeouts can cause Error 522: 19 seconds before the connection opens, and 90 seconds after it opens.
Before a TCP connection is set up, Cloudflare sends a SYN packet and waits for a SYN+ACK reply. Cloudflare's Error 522 page gives this limit as 19 seconds, with SYN retry gaps of 1, 1, 1, 1, 1, 2, 4 and 8 seconds.
After the connection opens, Cloudflare waits up to 90 seconds for data above the TCP layer, such as a Server Hello during TLS negotiation. If nothing arrives in that time, Cloudflare shows Error 522.
Cloudflare also marks 522 as retryable in its structured error responses, with a retry_after value of 120 seconds. That means a visitor should wait at least 120 seconds before trying again, as shown in Cloudflare's error responses guide.
How is Error 522 different from 521, 523 and 524?
Error 522 means no answer arrived in time, while 521 means the connection was refused and 524 means the server answered too slowly.
Each 52x code points to a different fault, so the code narrows the search. Use the table below to tell them apart before you change settings.
| Error | What happened | First place to look |
|---|---|---|
| 521 | Connection refused by the origin | Web server stopped, port closed, firewall rejecting traffic |
| 522 | Connection timed out, no reply at all | Firewall dropping Cloudflare IPs, wrong origin IP, overloaded server |
| 523 | Origin is unreachable | DNS points to an address Cloudflare cannot route to |
| 524 | Connection opened, but the reply took too long | Slow database query or long-running script |
The key split is between a refusal and silence. A stopped web server usually refuses the connection and gives 521, while a firewall that drops packets silently gives 522. For a slow reply after the connection opens, see the guide on how to fix the 504 gateway timeout error.
What causes Error 522 on WordPress most often?
A firewall that blocks or rate-limits Cloudflare IP addresses is the most common cause of Error 522.
Cloudflare's Error 522 page lists this first and calls it the most common cause. The block can sit in .htaccess, iptables or a host firewall.
Other causes from the same page, in order, are:
- An overloaded or offline origin server drops incoming requests.
- Keep-alive is disabled at the origin web server.
- The origin IP in Cloudflare DNS does not match the IP your host now gives you.
- Packets were dropped at your origin web server.
All visitor traffic arrives from a small set of Cloudflare addresses, so a firewall can mistake that volume for an attack. Cloudflare's IP address guide warns that this can trigger automatic blocking or rate limiting.
How do you confirm the origin server is up?
Check the origin directly, without Cloudflare in the path, to see if the server itself answers.
First, open your hosting panel and look at CPU and RAM use. Hostinger's tutorial notes that a server hitting its CPU or RAM limits cannot answer new requests.
It suggests keeping CPU use under 80% as of November 2026. If use is at the limit, a traffic spike or a heavy plugin can be the cause.
Next, try the site with Cloudflare paused. In the Cloudflare dashboard, open your site and use the pause option, then reload the page. If the site loads with Cloudflare paused, the fault is in the link between Cloudflare and the origin.
If the site still fails with Cloudflare paused, the origin itself is down. Check your host status page and the WordPress error log before you change Cloudflare settings. WordPress debugging docs at developer.wordpress.org explain how WP_DEBUG_LOG writes errors to a debug.log file in /wp-content.
How do you check the DNS record points to the right origin IP?
Compare the A record in Cloudflare DNS with the server IP shown in your hosting panel, and fix it if they differ.
Find the correct IP first. In your hosting panel, look for the server IP, shared IP or dedicated IP for your site. Copy it exactly, and do not take the IP from a public DNS lookup, because a proxied record returns a Cloudflare IP instead.
Then check Cloudflare:
- Log in to the Cloudflare dashboard and select your site.
- Open DNS, then Records.
- Find the A record for your root domain and read its Content value.
- Compare it with the IP from your hosting panel.
If the values differ, click Edit on the A record, paste the correct IP into Content, and save. Hostinger's Error 522 tutorial notes that DNS changes can take up to 24 hours to spread, as of November 2026.
A wrong IP often follows a host move or a server change. If you moved hosts and the error started right after, check this record first. The AAAA record for IPv6 needs the same check if your site uses one.
How do you allow Cloudflare IP addresses through the firewall?
Allow all Cloudflare IP ranges on ports 80 and 443 at every firewall layer, and remove any block on them.
Cloudflare publishes its ranges as plain text lists. The IPv4 list is at www.cloudflare.com/ips-v4, and there is a matching IPv6 list at ips-v6 on the same site. Use the current lists, not a copy from an old post, because ranges change over time.
Ask your host to allow the ranges if you use shared hosting. On a server you manage, Cloudflare's IP address guide shows an iptables example that accepts each range on ports 80 and 443, run once per range.
Also check these layers, because a block in any one of them can cause 522:
- Server firewall rules in iptables, ufw or your host panel
.htaccessrules that deny IP ranges- Security plugins that block repeated requests from one IP
- Rate-limit tools such as fail2ban or CSF that ban busy IPs
Cloudflare's IP guide also notes that security plugins should allow Cloudflare IP addresses, and that the ModSecurity plugin should be kept up to date. If the error comes and goes, a rate limiter that bans Cloudflare IPs for a short time is a likely cause.
How do you fix keep-alive and server overload?
Turn keep-alive on at the origin and lower the server load, because a server that cannot accept new connections will time out.
Keep-alive holds a connection open after a request instead of closing it each time. Cloudflare lists disabled keep-alive as a cause of 522, and Hostinger's tutorial says the same.
On Apache, the KeepAlive directive enables persistent connections. The Apache directive reference lists its default as On with a KeepAliveTimeout of 5 seconds as of November 2026.
To lower load on a WordPress site:
- Deactivate plugins you do not use, starting with any added just before the error began.
- Check for a backup, import or scan running at the same time as the errors.
- Look at the hosting panel for CPU, RAM and process limits that are being hit.
If the site is slow even without Cloudflare, read the guide on how to tell if your host is slowing WordPress down.
If load stays high at normal traffic, ask your host about a larger plan or more PHP workers. For general setup checks, see how to set up Cloudflare for WordPress.
How do you check Error 522 is fixed?
Reload the site in a fresh browser session, then check Origin Analytics for TCP failures to the origin.
Clear your browser cache first, or use a private window, so you do not see a cached error page. The home page and one inner page should both load without the “Connection timed out” message.
Then confirm with data in Cloudflare. Open Speed, then Origin Analytics, in the Cloudflare dashboard. Cloudflare's Origin Analytics guide says its status table maps a failed TCP connection to the origin as origin status 0 and edge status 522.
Use these checks:
- The site loads from two places, such as your phone on mobile data and your computer.
- Origin Analytics shows no new TCP failure rate on the affected paths.
- The error does not return during the next traffic peak.
If the error returns only at busy times, the cause is load, not DNS. If it returns on one path only, the Top endpoints table in Origin Analytics can show which path has the high TCP failure rate. For cache settings that can cut origin load, see Cloudflare cache rules for WordPress.
When should you contact your host?
Contact your host when the firewall, keep-alive or server load is outside your control, or when the checks above point to the origin.
Cloudflare's own advice is to contact your hosting provider first for most 5xx errors. Your host can see server logs, firewall blocks and resource use that you cannot see from the dashboard.
Send your host this information in one message:
- The affected URL and the time the error appeared, with your time zone
- The Ray ID shown at the bottom of the Cloudflare error page
- The origin IP in Cloudflare DNS and the IP your host shows for the site
- Whether the site loads with Cloudflare paused
Cloudflare's Error 522 page also asks for an MTR or traceroute from the origin to a Cloudflare IP that connected before the issue.
Add details from the host's own checks too. If your host finds nothing wrong and the error stays, pass those results to Cloudflare support.
What mistakes should you avoid?
Do not change many Cloudflare settings at once, and do not blame the visitor's connection for a 522 error.
Change one thing, reload the site, and note the result before the next change. Changing DNS, firewall rules and cache settings together hides which fix worked.
Avoid these errors:
- Turning Cloudflare off for good instead of fixing the origin, which removes its protection.
- Allowing only one or two Cloudflare IPs instead of all published ranges.
- Editing the wrong A record, such as a subdomain, while the root record stays wrong.
- Ignoring the error because it clears for a few minutes, when a rate limiter may ban Cloudflare again.
A 522 is an origin problem in almost every case, so a fix aimed at visitors will not help.
If you only see the error on one page, check that path in Origin Analytics before you change site-wide settings.
If the code changes after your fix, the related 502 bad gateway guide covers the next closest error.
Frequently asked questions
Can a visitor fix Cloudflare Error 522?
No, a visitor cannot fix Error 522 because the fault is between Cloudflare and the origin server. The visitor can wait at least 120 seconds and reload, then tell the site owner the time and the Ray ID from the error page. Only the site owner or the host can fix the firewall, DNS or server load behind it.
Does Error 522 mean my WordPress site is hacked?
No, Error 522 on its own does not mean the site is hacked. It means Cloudflare could not reach the origin server in time, which is usually a firewall block, a wrong origin IP, disabled keep-alive or an overloaded server. Check the server logs and the firewall first, and look for signs of a hack only if the logs show strange activity.
How long does Error 522 last?
It lasts until the cause is fixed, so a short outage can clear in minutes while a firewall block can last for days. A rate limiter that bans Cloudflare IPs for a set time can make the error come and go. Fix the cause, reload the site in a fresh browser session, and watch Origin Analytics to confirm no new TCP failures appear.
Will pausing Cloudflare fix Error 522?
Pausing Cloudflare is a test, not a fix. If the site loads while paused, the fault is in the connection between Cloudflare and the origin, such as a firewall block or a wrong origin IP. If it still fails while paused, the origin server itself is down. Turn Cloudflare back on after the test and fix the cause you found.
Can a plugin cause Cloudflare Error 522?
A plugin cannot cause a 522 directly, but a heavy plugin can overload the server so it stops answering Cloudflare in time. A security plugin can also block Cloudflare IP addresses if it treats their shared traffic as an attack. Deactivate new or heavy plugins one at a time and check whether the error clears after each change.
Sources
- Error 522: connection timed out Cloudflare Support docs
- Cloudflare IP addresses Cloudflare Docs
- Origin Analytics Cloudflare Docs
- Error responses Cloudflare Docs
- What is Error 522 and how to fix it? Hostinger Tutorials
- Debugging in WordPress WordPress Developer Resources
- Directive Quick Reference Apache HTTP Server Documentation
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
