Error 522 with Nginx & Fail2ban after removing all request limit

Error 522 witn Nginx & Fail2ban after removing all request limit adding ignoreip on fail2ban and checking cloudflare IPs aren’t banned

The servers are on Digitalocean

I use Nginx and Fail2ban

Cloudflare was running correctly during 24h but one day I got a peak of visits and I started to got error 522.

I paused cloudflare and trying to solve the problem.

  • I added ignoreips on jail.conf

ignoreip = 127.0.0.1/8 173.245.48.0/20 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 141.101.64.0/18 108.162.192.0/18 190.93.240.0/20 188.114.96.0/20 197.234.240.0/22 198.41.128.0/17 162.158.0.0/15 104.16.0.0/12 172.64.0.0/13 131.0.72.0/22

  • I removed all request limit on nginx.conf and domain configuration file

nginx.conf

#limit_req_log_level warn;
#limit_req_zone $binary_remote_addr zone=reqlimit:10m rate=5r/s;
#limit_conn_zone $binary_remote_addr zone=connlimit:100m;
#limit_conn servers 1000;

domain.conf

  #Rate Limiting
  #limit_req zone=reqlimit burst=20 nodelay;
  #limit_req_status 460; # Status to send
  #Connections Limiting
  #limit_conn connlimit 20; # Number of downloads per IP
  #Bandwidth Limiting
  #limit_rate 4096k; # Speed limit (here is on kb/s)
  • I checked that cloudflare IPs aren’t on iptables list

  • Restarted nginx and fail2ban

But, as soon as I reactivated cloudflare I got again error 522.

Any idea about what can I do for avoid 522?

Is there a way to test the connection between cloudflare and the web server without activate Cloudflare?