-
Notifications
You must be signed in to change notification settings - Fork 287
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
Add a Directive to get a Proxied Client's IP Address (Closes #341) #342
base: master
Are you sure you want to change the base?
Conversation
|
Please let me know, if the whitespace changes in the readme should be removed. I made the changes using VS Codium and didn't know that it forces a newline encoding. |
No worries, that's in a good place. Anyway, thanks for the PR - I'm thinking about we should add new test cases for each new PR (which adds a new feature - like this). I mean please take a look at the regression test file of this repository, how could we make a config where we can see that the modified code does what the author wants. And this is important, because if someone in the future sends a new PR, we must be sure this behavior does not change. Do you have any idea? |
Yeah, I have an idea for a test case. If that's alright with you, I would add 2 new endpoints to the test configuration:
What do you think of that? Footnotes |
Hi @thekief, I tried to check your patch, but may be I'm doing something wrong, I can't see the client's IP in my log. Here is my config:
As you can see I created a simple vhost for static files, there I turned on modsecurity, load rules and turned on your new feature. I also set a separated logs (both access and error). Below that I created a proxy which sends all requests to that site. Here is how I checked that:
where With this request I get this line in my error.log:
Where should I see my client IP instead of Or may be I misunderstand something. |
To clear up a small misunderstanding, the "Proxy Protocol" I am talking about, is specified in the I will add an example configuration tomorrow. Footnotes |
Thanks - then I can help you to create test cases. And of course, examples are always helpful. |
As written in #341, this patch adds functionality to obtain a client's IP address, if the request has been proxied using the Proxy Protocol.
Besides the check, if the option is enabled, I added a check if the Proxy Protocol is actually being used.