-
Notifications
You must be signed in to change notification settings - Fork 103
Add --trusted-ip to log real client IP from X-Forwarded-For #88
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
base: master
Are you sure you want to change the base?
Conversation
|
Not exactly what was proposed in 38, but solves the same problem. |
|
I would suggest handling the string stuff like here Lines 2202 to 2204 in d1e9e2d
... Then log 'log_ip' and free if allocated. Otherwise lgtm, but reverse proxy isn't my area. |
|
Done |
|
If you extract the parsing into a helper function, it'll be easier to write a unit-test... |
|
Well, I did it. Although I don't really like code bloat. |
|
Would you like to also write the unit test? ;) |
|
I think this is a nice commit and it's definitely useful for some people. I don't mean to nitpick, but I feel that using One case where this might be handy, is if say someone does Doesn't mean this necessarily has to happen. Just sharing my 2 cents worth. |
I refactored the implementation and removed the helper function. But I wrote (using LLM, although I checked) tests for the logs. I think this is better. In any case, you can discard the commit and use the old one.
I agree that strictly compliant IP parsing/canonicalization is more robust, but given darkhttpd's philosophy of being a simple, single-threaded, minimal server, pulling in full resolver logic for logging seems like overkill. |
|
I should also note that darkhttpd truncates URL parameters, and only the "file name" appears in the logs. For a static server, parameters are generally unnecessary, but it's worth noting that other web servers don't behave this way. Ideally, the full URL should be displayed in the logs. |
This option is very useful when working behind a reverse proxy.
Perhaps it should be enabled by default for the
127.0.0.1address. But I'm not sure about that.