Cloudflare "Too Many Redirects" errors with NGINX server


I had been using Cloudflare ZTNA Tunnels to expose a couple of self-hosted apps (Nextcloud and BlueIris) to the internet. They had both been working fine, but I borked my Nextcloud install so have started from scratch using NGINX as the webserver rather than Apache2.

I used certbot to install a certificate for the internal domain (lets call it nc.internal.tld for now), and it’s working great on the local network. I want to use Cloudflare to make it available on the external domain (nc.external.tld), so I’ve set up the Cloudflare DNS record for nc.external.tld to point via my tunnel.

However, whenever I enter nc.external.tld into my browser I get the “too many redirects” error, and sure enough I can see lots of 301 Permanently Moved errors.

My other apps are still working on the external domains.

I’ve tried changing the SSL/TLS settings in Cloudflare to every setting possible (Full (strict), Full, Flexible and Off), but these haven’t helped. I’ve followed the various suggested fixes and diagnostic guides but none of these have got me to a solution.

Wondering if anyone has any pointers or ideas?


What does your tunnel config look like? First guess is you are connecting to nextcloud via http, and it is redirecting to HTTPS and looping that way.

1 Like

I really don’t know why you have a Muppet as your profile picture. You, sir, are a hero. You were spot on. I think I looked at every setting except that one.

Thank you so much for taking the time to help me.

1 Like

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