I am running an application behind a haproxy reverse proxy in ssl pathtrough mode. The application works fine so far. In order to see the remote IP's, and not just the address of the reverse proxy, in the logfiles I followed these instruction:
frontend all_https
option forwardfor header X-Real-IP
http-request set-header X-Real-IP %[src]
Configure a custom log format in Nginx
Add a custom log format named “realip” (but name it the way you want…)
log_format realip '$http_x_real_ip - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
Use it in your access_log directive
access_log /dev/stdout realip;
access_log /path_to/log/file realip;
Having a look at the nginx logfiles, afterwards I only see a "-" instead of an IP. Without those lines the IP of the Reverseproxy is recorrded.
Maybe someone in here has go a hint.
Best
Krischan
frontend all_https
option forwardfor header X-Real-IP
http-request set-header X-Real-IP %[src]
Configure a custom log format in Nginx
Add a custom log format named “realip” (but name it the way you want…)
log_format realip '$http_x_real_ip - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
Use it in your access_log directive
access_log /dev/stdout realip;
access_log /path_to/log/file realip;
Having a look at the nginx logfiles, afterwards I only see a "-" instead of an IP. Without those lines the IP of the Reverseproxy is recorrded.
Maybe someone in here has go a hint.
Best
Krischan