Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork98
Improve X-Forwarded-For handling#495
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
semanticdiff-combot commentedNov 2, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Changed Files
|
Uh oh!
There was an error while loading.Please reload this page.
It looks fine to me. You need to add some log examples in the PR description of your tests and updatethe documentation page, you can find the doc pagehere and check outthis if you want to build the docs locally. Let me know when the PR is ready to review it. -- Additionally, I wonder if we also need to support atrust all proxies option for reverse proxies with non-static IPs like AWS ELB or similar. |
Yeah i took some time to think it over and to me it seemed the most sensible thing was to seperate the x-forwarded-for logging from the remote address logging completely. I have introduced two new options, one to toggle logging of the x-forwarded-for header and one to optionally allowlist certain IPs, where the default is to trust all IPs. I also ran into some issues when trying to build the docs, the commandhere doesn't seem to mount the docs in the correct directory. I also found some other small issues with the documentation, i will open a seperate issue for this. |
The docs instructions are kind of outdated but feel free to update them. For running the Docs dev server via Docker, just try |
This is ready to be reviewed btw. Sorry i forgot to mention that. |
Great, I will give it a check today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It looks fine to me.
I just left an update on the logging feature page to do. After that, we should merge the PR.
Uh oh!
There was an error while loading.Please reload this page.
Adds a `log-forwarded-for` option to control if the X-Forwarded-Forheader information should be logged. Also includes a `trusted-proxies`option to optionally specify from which IPs to accept this header.Existing uses of log-remote-address will stop logging forwarded-forIPs after this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Ready for the next release, Thanks!
13e3f38
intostatic-web-server:masterUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Description
Adds two new options to configure logging of X-Forwarded-IP addresses.
log-forward-for
: is a boolean to enable logging of the header in the first place. Logging is done in the same manner as log-remote-address, meaning it will only show with log-level info or highertrusted-proxies
: is an optional list of IP addresses from which to accept the x-forwarded-for header. If unspecified or an empty string, all IP addresses are allowedBoth of the options are optional and log-forward-for defaults to false. This means that existing uses of log_remote_address will silently stop logging from the x-forwarded-for header.
Related Issue
Resolves#494
Motivation and Context
See#494
How Has This Been Tested?
I have tested all combinations of
log-remote-addr
,log-forwarded-for
andtrusted-proxies
with both CLI options and a config file. I confirmed that they output the expected logs.Screenshots (if appropriate):
Some config snippets and what they output. The requests are all sent from
::1
withX-Forwarded-For: 1.1.1.1
Example 1:
Example 2 (this would reflect the old behavior):
Example 3:
Example 4: