Help understanding what headers are forwarded? #1671
Replies: 1 comment
-
|
For your topology, treat this as two separate questions: which proxy appends the address chain, and which headers your Flask app actually needs to trust. For I would not infer it from the final client IP alone. Add a temporary debug route in Flask that prints curl -H 'X-Forwarded-For: 1.2.3.4' https://your-site/debug-headersIf the edge proxy does not overwrite untrusted incoming
Yes, you can set only If that matches what you see in the header dump, this should be safe to mark as answered. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to set up a Flask application behind Anubis in a way where I can get the real client IPs. My setup is WAN -> Nginx Proxy Manager -> Anubis -> Flask application.
I need to configure
werkzeug.middleware.proxy_fix.ProxyFixin my application to tell it what to trust, so that I can get the real client IP within the application (it readsX-Forwarded-For). TheProxyFix-class takes the number of proxy jumps forX-Forwarded-For,X-Forwarded-Proto,X-Forwarded-HostandX-Forwarded-Prefix, and I understand it to be a security issue if I end up trusting headers spoofed by the client instead of the proxies.My pre-existing knowledge about this is as you can probably tell quite limited. Currently I'm stumped at finding out which of these headers are modified at each step.
X-Forwarded-Foryields correct client IP if I set all of them to 2, but how can I find out what Anubis is modifying?I guess also that since I am doing this fix only to get
X-Forwarded-For, I could instruct the application to only trust 2 jumps for that particular header and set the others to 0?Beta Was this translation helpful? Give feedback.
All reactions