Set X-Real-IP to Cf-Connecting-IP If exists #3514
Unanswered
nick-perry14
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, I have NPM set up with a custom dns server to do the following:
If external to network, proxy through cloudflare,
If internal, use NPM's internal IP.
As such, I would like to set X-Real-IP to the local ip accessing when internal (which should already be done automatically) but set it to the external IP (by using the value of Cf-Connecting-IP) when it's external.
The easiest way to do this would probably be to check the presence of the Cf-Connecting-IP header, and if it exists, set X-Real-IP to it. Is this possible using custom nginx config in NPM, and if so, what would that look like.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions