I have set up varnish as a proxy to redirect HTTP-request to backend-servers running apache.
I would like to have the clients IP-addresses in my apache logs instead of the varnish server IP-address. Here is my varnish configuration file:
backend $my_backend {
.host = "192.168.0.103";
.port = "80";
}
sub vcl_recv {
} else if (req.http.host == "$my_domain_name") {
set req.backend = $my_backend;
if (req.request == "POST") {
if (req.http.X-Forwarded-For) {
set req.http.X-Real-Forwarded-For = req.http.X-Forwarded-For ", " regsub(client.ip, ":.*", "");
unset req.http.X-Forwarded-For;
} else {
# Simply use the client IP
set req.http.X-Real-Forwarded-For = regsub(client.ip, ":.*", "");
}
return(pipe);
}
return(lookup);
}
}
On the backend apache config file I have this
RPAFenable On
RPAFsethostname On
RPAFproxy_ips $varnish_proxy_ip
RPAFheader X-Real-IP
The problem is that the instruction RPAFheader is not recognized on Debian6:
root@$hostname:~# apache2ctl configtest
Invalid command 'RPAFheader', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
root@$hostname:~#
Have anyone set up mod_rpaf on debian to give me a hand on this troublemod_rpaf
Thank you very much for your help!
Best Answer
Ok, I will answer my own question to help people who may have the same problem:
First add the following lines into varnish configuration file (default.vcl)
Then add personalized logs format for apache while configuring your vhost
That's it!