So I have a setup like Nginx -> varnish -> apache2 If I get a request with a static file it is sent through nginx to varnish and back to nginx again since its a lot faster than letting apache2 server it. My problem is that when I do a
sub vcl_fetch {
set beresp.http.X-Tabulex-Client = client.ip;
to see what the clients ip address is I am being told its 127.0.0.1 (X-Tabulex-Client 127.0.0.1) In the vcl_recv I have:
sub vcl_recv {
if((!req.url ~ "^/typo3temp/*" && !req.url ~ "^/typo3/*") && req.url ~ "\.(jpg|css|gif|png|js)(\?.*|)$") {
set req.backend = aurum;
set client.identity = req.http.X-Forwarded-For;
} elseif(client.ip == "192.168.3.189") {
/* Traffic from the other Varnish server, serve using real backends */
set req.backend = balance;
/* Set client.identity to the X-Forwarded-For (the real IP) */
set client.identity = req.http.X-Forwarded-For;
} else {
/* Traffic coming from internet, use the other Varnish as backend */
set req.backend = iridium;
}
The nginx config contains
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_intercept_errors on;
when sending to varnish the first time and nothing when receiving from varnish again.
Im not sure where the problem is. I would expect the client.ip to contain the external ip address so I could use it for acl. Any ideas?