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

Space between IP Addresses in $http_x_forwarded_for #36

Open
jasonrogena opened this issue Jan 16, 2018 · 1 comment · May be fixed by #45
Open

Space between IP Addresses in $http_x_forwarded_for #36

jasonrogena opened this issue Jan 16, 2018 · 1 comment · May be fixed by #45

Comments

@jasonrogena
Copy link

jasonrogena commented Jan 16, 2018

Nginx's $http_x_forwarded_for can contain multiple IP addresses (in cases where a reverse proxy is used). In such cases the format used is [IP Address]([Comma][Space][IP Address])+. I guess since this value is gotten from the X-Forwarded-For header.

Gonx is able to parse [IP Address]([Comma][Space][IP Address])+ but not [IP Address]([Comma][IP Address])+.

jasonrogena added a commit to jasonrogena/gonx that referenced this issue Jan 18, 2018
Since there's the possibility for the http_x_forwarded_for Nginx
variable to contain a space (right after the comma separating two IP
addresses), create a regex for handling this variable. Change the way
the Nginx format regex is created by adding logic for including special
regexes.

Fixes satyrius#36

Signed-off-by: Jason Rogena <jasonrogena@gmail.com>
jasonrogena added a commit to jasonrogena/gonx that referenced this issue Jan 18, 2018
Since there's the possibility for the http_x_forwarded_for Nginx
variable to contain a space (right after the comma separating two IP
addresses), create a regex for handling this variable. Change the way
the Nginx format regex is created by adding logic for including special
regexes.

Fixes satyrius#36

Signed-off-by: Jason Rogena <jasonrogena@gmail.com>
@typ431127
Copy link

当 http_x_forwarded_for 有多个ip时,没有办法解析日志,我使用 conradolega https://github.com/conradolega/gonx/tree/fix-http-forwarded-for 解决了这个问题

When http_x_forwarded_for has multiple ips, there is no way to parse the logs, I solved the problem using conradolega https://github.com/conradolega/gonx/tree/fix-http-forwarded-for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants