-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Remove square brackets from ipv6 addresses in XFF #2182
Conversation
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.
I do not understand why this change is only applied to IPs related to XForwardedFor. There are couple of more functions that could extract headers with square brackets.
Because netscaler only uses XForwardedFor, but I'll modify it for the others too if needed. |
|
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.
Everything other than this one comment (of missing strings.TrimSpace
at `context.RealIP) is OK and I'll merge it when this is fixed.
@aldas i've fixed it a while ago, any more remarks about this PR? |
I am sorry for the delay. I often forget to recheck PRs |
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.
LTGM
Some loadbalancers (eg citrix ADC / netscaler) add square brackets around the ipv6 address in the X-Forwarded-For header.
This PR removes them so that RealIP() and friends work correctly.