[GH-ISSUE #268] Cloudflare only switch #237

Closed
opened 2026-02-26 06:31:40 +03:00 by kerem · 9 comments
Owner

Originally created by @vrelk on GitHub (Dec 31, 2019).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/268

Could we get an option to enable that would cause a 403 to be returned if the client isn't a cloudflare IP? This would be nice to force direct access, mainly for things like cloudflare access. Seeing as rewriting the client IP is forced, that prevents the normal way of doing this.

Originally created by @vrelk on GitHub (Dec 31, 2019). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/268 Could we get an option to enable that would cause a 403 to be returned if the client isn't a cloudflare IP? This would be nice to force direct access, mainly for things like cloudflare access. Seeing as rewriting the client IP is forced, that prevents the normal way of doing this.
kerem 2026-02-26 06:31:40 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@Rustymage commented on GitHub (Jan 9, 2020):

I like this suggestion.

<!-- gh-comment-id:572765002 --> @Rustymage commented on GitHub (Jan 9, 2020): I like this suggestion.
Author
Owner

@webbson commented on GitHub (Mar 2, 2020):

I would really like this too, would be really helpful in combination with Cloudflare access to restrict access to certain areas.
I've tried to solve it with a custom config on advanced containing
allow 173.245.48.0/20; allow 103.21.244.0/22; allow 103.22.200.0/22; allow 103.31.4.0/22; allow 141.101.64.0/18; allow 108.162.192.0/18; allow 190.93.240.0/20; allow 188.114.96.0/20; allow 197.234.240.0/22; allow 198.41.128.0/17; allow 162.158.0.0/15; allow 104.16.0.0/12; allow 172.64.0.0/13; allow 131.0.72.0/22; deny all;

This however blocks all requests. Inspecting the log shows that the requests are logged with the real IP of the visitor even though the traffic goes through Cloudflare.

Edit: Sorry for line break not working in code block

<!-- gh-comment-id:593253927 --> @webbson commented on GitHub (Mar 2, 2020): I would really like this too, would be really helpful in combination with Cloudflare access to restrict access to certain areas. I've tried to solve it with a custom config on advanced containing `` allow 173.245.48.0/20; allow 103.21.244.0/22; allow 103.22.200.0/22; allow 103.31.4.0/22; allow 141.101.64.0/18; allow 108.162.192.0/18; allow 190.93.240.0/20; allow 188.114.96.0/20; allow 197.234.240.0/22; allow 198.41.128.0/17; allow 162.158.0.0/15; allow 104.16.0.0/12; allow 172.64.0.0/13; allow 131.0.72.0/22; deny all; `` This however blocks all requests. Inspecting the log shows that the requests are logged with the real IP of the visitor even though the traffic goes through Cloudflare. **Edit: Sorry for line break not working in code block**
Author
Owner

@Rustymage commented on GitHub (Apr 11, 2020):

I wonder if there is a cloudflare settings toggle?

<!-- gh-comment-id:612418427 --> @Rustymage commented on GitHub (Apr 11, 2020): I wonder if there is a cloudflare settings toggle?
Author
Owner

@Rustymage commented on GitHub (Apr 17, 2020):

This suggests Cloudflare does not add the visitor IP address to the header...

Screenshot 2020-04-17 at 21 12 38
<!-- gh-comment-id:615444070 --> @Rustymage commented on GitHub (Apr 17, 2020): This suggests Cloudflare does not add the visitor IP address to the header... <img width="1074" alt="Screenshot 2020-04-17 at 21 12 38" src="https://user-images.githubusercontent.com/19926955/79610318-381aac80-80f0-11ea-8a88-2a0bf65ca7a3.png">
Author
Owner

@vrelk commented on GitHub (Apr 18, 2020):

It actually does using X-forwarded-for. The nginx config just replaces the
client IP with the value of that header, which then makes it so you can't
validate that it is a cloudflare IP.

On Fri, Apr 17, 2020, 4:15 PM Anthony notifications@github.com wrote:

This suggests Cloudflare does not add the visitor IP address to the
header...

[image: Screenshot 2020-04-17 at 21 12 38]
https://user-images.githubusercontent.com/19926955/79610318-381aac80-80f0-11ea-8a88-2a0bf65ca7a3.png


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jc21/nginx-proxy-manager/issues/268#issuecomment-615444070,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAEY5PIXKHO2PMFNSPMYY5TRNC2ERANCNFSM4KBS4IUQ
.

<!-- gh-comment-id:615539915 --> @vrelk commented on GitHub (Apr 18, 2020): It actually does using X-forwarded-for. The nginx config just replaces the client IP with the value of that header, which then makes it so you can't validate that it is a cloudflare IP. On Fri, Apr 17, 2020, 4:15 PM Anthony <notifications@github.com> wrote: > This suggests Cloudflare does not add the visitor IP address to the > header... > > [image: Screenshot 2020-04-17 at 21 12 38] > <https://user-images.githubusercontent.com/19926955/79610318-381aac80-80f0-11ea-8a88-2a0bf65ca7a3.png> > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/jc21/nginx-proxy-manager/issues/268#issuecomment-615444070>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AAEY5PIXKHO2PMFNSPMYY5TRNC2ERANCNFSM4KBS4IUQ> > . >
Author
Owner

@Rustymage commented on GitHub (Apr 20, 2020):

I see - I've now added a hardware firewall on the network which does the heavy lifting of checking for Cloudflare IPs. Problem circumvent and solved.

<!-- gh-comment-id:616481957 --> @Rustymage commented on GitHub (Apr 20, 2020): I see - I've now added a hardware firewall on the network which does the heavy lifting of checking for Cloudflare IPs. Problem circumvent and solved.
Author
Owner

@netstx commented on GitHub (Mar 5, 2021):

Could this be why my NPM proxy host to a Cloudflare endpoint (website on their CDN) doesn't work for me? I keep getting 403 forbidden error on the page (cloudflare error, not npm).

<!-- gh-comment-id:791167289 --> @netstx commented on GitHub (Mar 5, 2021): Could this be why my NPM proxy host to a Cloudflare endpoint (website on their CDN) doesn't work for me? I keep getting 403 forbidden error on the page (cloudflare error, not npm).
Author
Owner

@github-actions[bot] commented on GitHub (Mar 31, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2028525732 --> @github-actions[bot] commented on GitHub (Mar 31, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@github-actions[bot] commented on GitHub (May 10, 2025):

Issue was closed due to inactivity.

<!-- gh-comment-id:2868225303 --> @github-actions[bot] commented on GitHub (May 10, 2025): Issue was closed due to inactivity.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#237
No description provided.