I'm using nginx as a front end reverse proxy for Apache, I have the following configuration inside of nginx:
location / {
if (-f $request_filename) {
add_header X-Static hit;
access_log off;
}
if (!-f $request_filename) {
proxy_pass https://127.0.0.1:8000;
add_header X-Static miss;
}
With apache listening on port 8000 locally. When I look at apache's logs all the requests come from 127.0.0.1:443 (which is where nginx is sitting). I want to forward the real IP to apache so that it stores it properly in the logs.
I tried adding the following lines to the location block to no avail
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Am I missing a step here? Do I need to change apache's log format? It is currently using the default combined log.