522 Unofficial (Cloudflare) 📋

522 Connection Timed Out: Origin Server Too Slow

Last updated: June 28, 2026 • 5 min read

✦ The Golden Answer: The 522 Connection Timed Out is a Cloudflare-specific status code. It means that Cloudflare successfully established a TCP connection to your origin server, but the origin server did not complete the HTTP response within the allowed time (typically 10-15 seconds). This is a timeout — the server is reachable, but it's too slow to respond. The fix involves optimizing your backend code, increasing server resources, or using caching to reduce response times.

Common Causes of 522 Errors

CauseExampleHow to Fix
Slow backend scriptsPHP, Node.js, or Python script takes longer than 10 seconds to execute.Optimize the code, use caching, or offload heavy processing to background jobs.
Database query bottlenecksUnoptimized SQL queries, missing indexes, or large datasets.Add indexes, optimize queries, or use query caching.
Server resource exhaustionHigh CPU, low memory, or disk I/O bottlenecks.Upgrade server resources or optimize the application to reduce resource usage.
External API callsYour server calls an external API that is slow to respond.Implement timeouts and fallbacks; use asynchronous processing.
Network latencyHigh latency between Cloudflare and your origin server.Move your server closer to Cloudflare's edge nodes or use a faster hosting provider.

Example: Cloudflare 522 Error Page

Cloudflare displays a user‑friendly error page for 522 errors:

HTTP/1.1 522 Connection Timed Out Content-Type: text/html <html> <body> <h1>522: Connection Timed Out</h1> <p>The origin server took too long to respond. Please try again later.</p> </body> </html>

How to Fix 522 Errors

  • Optimize your backend: Profile your application to find slow code paths. Use caching (e.g., Redis, Memcached) to reduce database load. Minimize external API calls.
  • Increase server resources: If your server is overloaded, upgrade to a more powerful instance or add more resources (CPU, RAM).
  • Use a CDN or caching: Cache static assets and dynamic content at the edge to reduce load on the origin.
  • Increase timeout in Cloudflare: If you're on a Pro or Business plan, you can increase the timeout (up to 100 seconds). For Free plan, it's fixed at 10 seconds.
  • Check database performance: Optimize slow queries, add indexes, or consider using a read replica.

Cloudflare Timeout Limits

  • Free plan: 10 seconds
  • Pro plan: 30 seconds
  • Business plan: 100 seconds (configurable)
  • Enterprise plan: custom

If your application consistently takes longer than the allowed timeout, consider using a job queue for long-running tasks and returning a 202 Accepted response.

Frequently Asked Questions

Is 522 a client error or a server error?

It is a server error (5xx) because the origin server is too slow to respond. Cloudflare is working correctly; the origin is the bottleneck.

Can I fix a 522 error from the client side?

No, it is a server‑side performance issue. Only the website owner or server administrator can fix it.

What is the difference between 522 and 524?

522 means the origin took too long to send the complete response. 524 is similar but is specifically a timeout that occurs during the response phase (after the connection is established). In practice, they are often used interchangeably by Cloudflare.