I'm running nginx behind a proxy and use the real IP module along with the X-Forwarded-For header to log the real client address in access.log. This works fine for normal requests, but fails with an invalid one.
I enabled connection debugging to find this:
2020/05/06 10:21:58 [info] 1181#1181: *53597678 client sent invalid request while reading client request line, client: <proxy address>, server: _, request: "GET <a broken request> HTTP/1.1"
I couldn't find any headers in the debug log for that request, so the logging probably happens too soon prior to headers being parsed in the case of an invalid request?
The invalid requests are not the problem. They come from a tester that sends all manner of things. I'd like to have the real client address in the log in these cases too. Is there anything that can be done?
I enabled connection debugging to find this:
2020/05/06 10:21:58 [info] 1181#1181: *53597678 client sent invalid request while reading client request line, client: <proxy address>, server: _, request: "GET <a broken request> HTTP/1.1"
I couldn't find any headers in the debug log for that request, so the logging probably happens too soon prior to headers being parsed in the case of an invalid request?
The invalid requests are not the problem. They come from a tester that sends all manner of things. I'd like to have the real client address in the log in these cases too. Is there anything that can be done?