My domain name is returning a 522 error

I have a .net core web api deployed on nginx web server which is all running on my raspberry pi. The api works in http but i am trying to have it working in https. I have followed all the instructions for using certbot to get ssl certificates but still have no luck trying to get this to work. I have read the cloudflare troubleshooting guide for 522 errors and added cloudflare ip addresses to my config but it still didnt work. I bought my domain name from namecheap and am using cloudflare as the public dns provider. I have already copied and pasted the cloudflare nameservers to namecheap. Here’s what i set up for dns records in cloudflare:

Typ: A, Name:, Value: webserver-ip, TTL: auto, Proxy enabled
Typ: CNAME, Name: www, Value:, TTL: auto, Proxy enabled

I am using full mode for SSL/TLS encryption.

Please let me know if you would like to see any other configs like from nginx (if it helps you help me)

A 522 error happens when a TCP connection to the web server could not be established. This typically happens when our requests to the origin (your webserver) get blocked. Here is what I recommend in order to ensure all requests from Cloudflare are accepted by your server:

  1. Make sure that you’re not blocking Cloudflare IPs in .htaccess, iptables, or your firewall.
  2. Make sure your hosting provider isn’t rate limiting or blocking IP requests from the Cloudflare IPs and ask them to allowlist the IP addresses here: IP Ranges.

If you are seeing 522 errors in certain locations only, it means you likely forgot to allowlist one of our ranges that corresponds to these locations, so double check to ensure all our IPs are allowlisted appropriately.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.