●HTTP
         X-Varnish HTTP头的用途?
                   X-Varnish HTTP头可以让你找到正确的日志记录,比如命中cache,X-Varnish控制当前请求的次数和增加cache中的请求数。它让debugging非常容易。
        
         Varnish支持压缩吗?
                   这个简单的问题有一个复杂的回答,请看WIKI
        
         我怎么样添加一个HTTP头?
                   添加一个HTTP头,除非你想要添加一些关于客户端请求的东西,添加HTTP头最好在vcl_fetch中完成,这个方法将处理每个fetched的目标:
                   sub vcl_fetch {
                    # Add a unique header containing the cache servers IP address:
                    remove obj.http.X-Varnish-IP;
                    set    obj.http.X-Varnish-IP = server.ip;
                    # Another header:
                    set    obj.http.Foo = "bar";
                   }
         我怎么样才能在后端服务器记录客户端的IP地址?
                   通常我们看见的IP地址是varnish服务器的,怎么样我们才能看见客户端的IP地址呢?
                   我们需要添加这些IP地址到一个头,然后和请求一起发送给后端服务器,然后配置后端服务器的日志记录这个头信息的内容:
                   Varnish configuration
                   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;
                    # [...]
                   }
                   以apache配置为例,我们拷贝 combined 日志格式,改名为“varnishcombined”,我们在格式中加入varnish定义的头:
                   LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" varnishcombined
                   然后在你的主机配置部分,使用定制的日志格式替换标准的格式:
                   <VirtualHost *:80>
                    ServerName www.example.com
                    # [...]
                    varnishcombined /var/log/apache2/www.example.com/access.log varnishcombined
                    # [...]
                   </VirtualHost>
                   The [http://www.openinfo.co.uk/apache/index.html mod_extract_forwarded Apache                module] might also be useful.