-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
X-Forwarded-For not being rewritten #6
Comments
First of all, thanks to @Paxxs for this plugin, it's working fine and I love the fact that you can rewrite the realIP based on the content of any header: thanks to this feature, and the fact I'm using cloudflared (tunnel), I have an existing The only problem I noticed is that X-Forwarded-For is not being rewritten, even though in the debug log it seems the plugin says it has been rewritten, exactly like @sleepymatto clearly explained. I hope this small issue can be fixed, so finally we'll have the perfect realIP plugin. Keep up the good work. :) |
The issue I faced was that no plugin seemed to work, so I took a step back and realized the plugins don't create an inherit trust between upstream and Traefik. What I had to do is make Traefik trust the 'X-Forwarded-For' header, see: 'traefik.yml'. I'm hoping this is applicable to your situations and this'll help. You may need to update a few things. Dynamic config
traefik.yml
Docker
Result:
|
I already had this configuration, but thanks anyway for the heads up. As I wrote before, the debug logs of the plugin show that the XFF header has been rewritten, but that is not actually the case. Did you check that XFF in your case is being rewritten? |
Hi @mattkbach, I appreciate your detailed testing and feedback. Thank you for using my plugin and for bringing this issue to my attention. @alexdelprete also reported a similar issue. Regarding the The current function of the For example, with the following configuration:
# traefik static configuration
entryPoints:
http:
address: ":8000"
forwardedHeaders:
insecure: true # dynamic plugin configuration
Proxy:
- proxyHeadername: X-From-Cdn
proxyHeadervalue: 1-cdn
realIP: Client-Ip
OverwriteXFF: true Using the
But with the plugin enabled in the request:
At the moment, I don't have a way to fully overwrite the content of the Thanks again for using my plugin and for your feedback! 💗 I would be happy to help you with this issue. Best regards. |
This is how I managed to make it work.
|
Hello,
First, thank you for making this plugin .. much appreciated!
The issue i'm facing is that even though the logs state that the X-Forwarded-For header is being rewritten, it does not appear to actually be working. I'm running Traefik v2.7.3
Middleswares config:
Logs from Traefik (###.###.###.### is the correct external IP):
From Whoami (with your plugin enabled):
From Whoami (with your plugin disabled):
So with your plugin enabled, the X-Real-IP is being set to the correct IP. The problem is with X-Forwarded-For. In the logs it says its being set to the correct IP, but the 10.10.10.1 address is still in the X-Forwarded-For. Testing with your plugin enabled/disabled, the X-Forwarded-For is the same so it appears as if the X-Forwarded-For is not being rewritten. 10.10.10.1 is the gateway/router IP.
I think I have it setup correctly but some help would be much appreciated!
Thank you :)
The text was updated successfully, but these errors were encountered: