[SOLVED] Need help with Connection Timed out (522)

Hello everyone, I’m new to Cloudflare and web services in general.
I have a domain name with namecheap and I changed the namespace correctly to Cloudflare’s namespace.
I hosted my website on my raspberry pi with proper portforwarding.
I have also updated the A record on Cloudflare to be my public IP address.

However when accessing my website through my domain name, I got 522 error.
If I access the website through my public IP address, it works fine though.

Does anyone have any idea what might happening?
From my research I think 522 means my website is taking too long to response but it works just fine and fast if I access from my public IP.

Any iptables rules in place?

whitelist Cloudflare

https://www.clodflare.com/ips

I just checked there are no rules.


How do I whitelist Cloudflare?
Btw I just thought of this but I have only change update the A record for a few hours. Could it be the changes are not in effect yet?

You can check the Support pages for detailed information on error 522.

You might be using an alternative to iptables like firewalld.

Can you curl your website directly at the IP?

curl --verbose --header 'Host: example.com' http://192.0.2.1

or if you have a valid certificate and are using Full SSL mode:

curl --verbose https://example.com --resolve 'example.com:443:192.0.2.1'

@michael thank you for your input.

I try firewall-cmd but it said command not found on my Raspberry pi

This is what happen if I try to curl my public ip

I can see a few things that look wrong. Your nameservers are not pointing at Cloudflare:

$ dig +short ns phuoctran.com 
dns2.registrar-servers.com.
dns3.registrar-servers.com.
dns1.registrar-servers.com.
dns4.registrar-servers.com.
dns5.registrar-servers.com.

And even if they were, it looks like your domain does not exist on Cloudflare:
$ curl -H "Host: phuoctran.com" http://www.cloudflare.com/ -Is | grep HTTP HTTP/1.1 409 Conflict

409 errors can mean that the domain is not configured on Cloudflare at all.

Where are you seeing the 522?

Thanks for your help.

Indeed it is my bad in configuring my name server. Previously I received 502 when I accessed phuoctran.com

It is now solved! I found that my CNAME is aliasing www for the parking page of namecheap. I don’t really understand how it works but after changing CNAME to phuoctran.com, it is now working correctly and pointed to my rasberry pi webserver.

I really should look more into how these things work!

1 Like

I’m a little bit confused. You marked the issue as resolved, but you are not behind Cloudflare. I would expect that a solution to your problem would include your nameservers pointing at CF, and your hostname being Orange clouded.

Anyway, glad you got it resolved to your satisfaction.

This topic was automatically closed after 31 days. New replies are no longer allowed.