Constant 522 errors with CF and Swag (NGINX)

For a few weeks I have been dealing with getting a 522 on most if not all of my self hosted services. There are a few times where it will work and then 1 minute later it will throw a 522 error and I cant figure out why. More times than not I get the error. I am using Cloudflare Proxy and have been for a few months now. I am using the Swag (nginx) docker container on my Unraid system.
I have seen in reports a week a so ago, CF did have issues with a bunch of 522 errors but has been marked as fixed. I really cant tell if this is a local or CF issue. If anyone can help me out with some good troubleshoot tips on how I can test this that would be great. My swag logs show nothing and not sure how to go about it. Thanks.

Edit: I looked into fail2ban in the Swag container. I removed any potential bans and whitelisted the cf ip but it has not worked at all. Removing Proxied and going back to DNS only in CF made everything work

1 Like

I was having the same issue as you, but seem to have fixed it (for now at least), though I still run into some 525 errors now and then and have to refresh.

In terms of troubleshooting, you might want to check out the (cloudflare_real-ip Docker mod for SWAG)[GitHub - linuxserver/docker-mods at swag-cloudflare-real-ip], and then add the following lines added to your nginx.conf:

real_ip_header X-Forwarded-For;
real_ip_recursive on;
include /config/nginx/cf_real-ip.conf;

The cf_real-ip.conf will contain a whitelist of Cloudflare IPs.

These two posts were also helpful in getting it working, so probably worth a look even if you’re not specifically using Organizr:

https://technicalramblings.com/blog/banning-with-http-auth-and-fail2ban/

https://technicalramblings.com/blog/fail2ban-with-organizr-and-let-sencrypt/

1 Like

Domain? (Website?)

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