Skip to content
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

Fix parsing of X-Forwarded-For header when trustAnyForwardedAddress is enabled #611

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

silkeh
Copy link
Contributor

@silkeh silkeh commented Aug 28, 2024

This PR solves a parsing error when trustAnyForwardedAddress is enabled. This is caused by the X-Forwarded-For header containing an IP address, and not a host+port. This causes the split to fail with missing port in address or too many colons in address, leading in the feature not actually working.

Additionally, I've included two minor enhancements in the logging:

  • Add resolved remote address/host to log entries.
  • Add the subject that is rate limited to the logged entry.

Solve a parsing error when `trustAnyForwardedAddress` is enabled.
This is caused by the `X-Forwarded-For` header containing an IP address,
and not a host+port.
The current logs contain only the original host and remote address.
This makes it difficult to see who actually performed the request without correlating other logs.

Add these values to the log context in addition to the original values.
Add the subject that is rate limited to the logged entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant