Cloudflare > Nginx reverse proxy > Digital Ocean specific problem

Hello guys, I am having this very specific problem. Will try my best to describe what is the deal.

I am running a server on Digital Ocean behind NGINX Reverse Proxy.
I create A record in my Cloudflare (mydomain.com) pointing to digital ocean droplets IP.
Everything works good:

REQUEST FROM INTERNET > Cloudflare PROXY > NGINX REVERSE PROXY > DIGITAL OCEAN SERVER.

However, When I am trying to put a single IP address (for example address of my VPN server X.X.X.X ) in nginx reverse proxies Access List (So that only that IP will have access to the server).
Everything stops working, and I know why.
Nginx waits for requests only from X.X.X.X , and because the scheme appears to be like this:

X.X.X.X > Cloudflare PROXY > NGINX REVERSE PROXY > DIGITAL OCEAN SERVER

I is logical that NGINX doesn’t send any response (because it is waiting for connection from X.X.X.X and the connection comes from CLOUDFLARES PROXYS IP)

The issue is, that when I am turning off Cloudflare proxy (toggling the little orange cloud to OFF position) Server doesn’t respond. With my understanding, when I turn it off, connection should be coming like this:

X.X.X.X > NGINX REVERSE PROXY > DIGITAL OCEAN SERVER

Anyone knows what the issue might be? Let me know if you need any additional info I will try to provide everything possible. Thank you everyone in advance.

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