Skip to content

Cloudflare Error 522: Connection timed out

0

My website, tokobliss.in, is showing a Cloudflare 522 error. This means Cloudflare can't maintain a stable connection to the server. Can you please check if the server is online, not overloaded, and if the firewall is blocking Cloudflare's IP addresses? This issue arrives every second day after rebooting the server as well. Please help me fix this issue. how can i check below things - Is the server online and responding? Is the server overloaded with traffic or a process (like a backup) that is "hogging resources"? Firewall Rules - firewall might be mistakenly identifying Cloudflare's requests as an attack and blocking them.

1 Answer
0

When you're experiencing a Cloudflare Error 522 (Connection timed out) with your website, it means Cloudflare can establish a TCP connection to your origin server but the origin doesn't respond to the HTTP request within the allocated time. Let me help you troubleshoot this issue.

To check if your server is online and responding:

  1. SSH into your server if possible
  2. Use the curl command to test the website locally: curl -ivL http://localhost or curl -ivL https://tokobliss.in
  3. If the command shows a connection timeout or refusal, there's likely an issue with your web server configuration

To check if your server is overloaded:

  1. Monitor system resources using commands like top or htop to check CPU and memory usage
  2. Look for processes consuming excessive resources
  3. Check your web server logs (Apache, Nginx, etc.) for any error messages
  4. Review your application logs for potential issues
  5. Check if your database connections are functioning properly

To check if your firewall is blocking Cloudflare's IP addresses:

  1. Verify your EC2 instance's security group allows incoming traffic on ports 80 (HTTP) and 443 (HTTPS) from all sources (0.0.0.0/0) or specifically from Cloudflare's IP ranges
  2. If using an operating system firewall (like UFW on Ubuntu), check its status with sudo ufw status numbered and ensure it allows traffic on ports 80 and 443
  3. For iptables, list the rules and verify they're not blocking Cloudflare IPs

Since you mentioned the issue occurs after rebooting the server, also check:

  1. If your web server (Apache, Nginx, etc.) is configured to start automatically on boot
  2. If there are any startup scripts that might be interfering with your web server
  3. If your application requires other services (like databases) that might not be starting properly

If all these checks pass but you're still experiencing issues, try restarting your web server service and monitoring the logs for any errors during startup.
Sources
Troubleshoot connection errors | AWS re:Post
EC2 Website Connection Timeout | AWS re:Post
Resolve website access issues in Amazon Route 53 | AWS re:Post

answered 9 months ago
AWS
EXPERT
reviewed 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.