How do I only allow Cloudflare IPs to access my server?

I would like to know how to configure NGINX to only allow IPs that come directly from Cloudflare, any non-CloudFlare IPs being redirected to another URL.
For some reason, NGINX grabs the client real IP.
I’ve looked a lot, but most of it is like getting the real client IP when it’s behind CloudFlare, or using IPtables, but the latter doesn’t work with URLs I understand.

Possible relevant details:
I run Nginx Proxy Manager on Hassio, and I have the orange-cloud enabled.

Your NGINX config is good, but server firewall isn’t handled by NGINX. It’s OS dependent, so you’ll have to check other internet resources on how to configure the firewall on your particular server.

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