Updated Varnish default.vcl

I wasn’t able to get the varnish logs in a format awstats/jawstats could understand. After a LOT of googling, I’ve gotten this to work. I added

sub vcl_recv {
  # Add a unique header containing the client address
  remove req.http.X-Forwarded-For;
  set    req.http.X-Forwarded-For = client.ip;
}

as you can see below.

[ root@CainManor:/etc/varnish ] cat default.vcl
backend default {
.host = "173.230.157.240";
.port = "8080";
}
 
sub vcl_recv {
# Add a unique header containing the client address
# This is so we can forward the headers to the Apache logs.
  remove req.http.X-Forwarded-For;
  set    req.http.X-Forwarded-For = client.ip;
}
 
sub vcl_recv {
# Let's make sure we aren't compressing already compressed formats.
    if (req.http.Accept-Encoding) {
        if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|mp3|mp4|m4v)(\?.*|)$") {
            remove req.http.Accept-Encoding;
        } elsif (req.http.Accept-Encoding ~ "gzip") {
            set req.http.Accept-Encoding = "gzip";
        } elsif (req.http.Accept-Encoding ~ "deflate") {
            set req.http.Accept-Encoding = "deflate";
        } else {
            remove req.http.Accept-Encoding;
        }
    }
# Remove cookies and query string for real static files
    if (req.url ~ "^/[^?]+\.(jpeg|jpg|png|gif|ico|js|css|txt|gz|zip|lzma|bz2|tgz|tbz|html|htm)(\?.*|)$") {
       unset req.http.cookie;
       set req.url = regsub(req.url, "\?.*$", "");
    }
# Remove cookies from front page
    if (req.url ~ "^/$") {
       unset req.http.cookie;
    }
}