Varnish Serves only uncompressed objects if they are requested first
Jeff Anderson
jeff at funnyordie.com
Wed Dec 3 03:54:39 CET 2008
It looks like if the first requested page is for an uncompressed page
varnish will only deliver the uncompressed page from cache even if a
compressed page is requested.
--After a fresh bounce of varnish---
**** Requesting uncompressed page first
Curl request:
$ curl http://prodweb9/ --head
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
X-Runtime: 2.06915
ETag: "c10816a9ec10679b3ac800a4b2e3e70b"
Cache-Control: no-cache, public, max-age=300
Server: LiteSpeed
Content-Length: 60261
Date: Wed, 03 Dec 2008 02:19:15 GMT
X-Varnish: 353939895
Age: 0
Via: 1.1 varnish
Served-by: prodweb9/prodapp5
Connection: close
Varnishlog output:
8 SessionOpen c 172.16.200.145 56473 :80
8 ReqStart c 172.16.200.145 56473 353939895
8 RxRequest c HEAD
8 RxURL c /
8 RxProtocol c HTTP/1.1
8 RxHeader c User-Agent: curl/7.16.3 (powerpc-apple-
darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
8 RxHeader c Host: prodweb9
8 RxHeader c Accept: */*
8 VCL_call c recv
8 VCL_return c lookup
8 VCL_call c hash
8 VCL_return c hash
8 VCL_call c miss
8 VCL_return c fetch
9 BackendClose b default
9 BackendOpen b default 172.16.160.85 23565 172.16.160.174 80
8 Backend c 9 default default
9 TxRequest b GET
9 TxURL b /
9 TxProtocol b HTTP/1.1
9 TxHeader b User-Agent: curl/7.16.3 (powerpc-apple-
darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
9 TxHeader b Host: prodweb9
9 TxHeader b Accept: */*
9 TxHeader b X-Varnish: 353939895
9 TxHeader b X-Forwarded-For: 172.16.200.145
9 RxProtocol b HTTP/1.1
9 RxStatus b 200
9 RxResponse b OK
9 RxHeader b Content-Type: text/html; charset=utf-8
9 RxHeader b Set-Cookie:
_fod_session
=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
%0ASGFzaHsGOg5yZXR1cm5fdG8iBi8GOgpAdXNlZHsGOwZG
--5181ccb5b65c2f75cafa4a6a89f0932ab07d1391; path=/
9 RxHeader b X-Runtime: 2.06915
9 RxHeader b ETag: "c10816a9ec10679b3ac800a4b2e3e70b"
9 RxHeader b Served-by: prodapp5
9 RxHeader b Cache-Control: no-cache, public, max-age=300
9 RxHeader b Content-Length: 60261
9 RxHeader b Date: Wed, 03 Dec 2008 02:19:15 GMT
9 RxHeader b Server: LiteSpeed
9 RxHeader b Connection: Keep-Alive
9 RxHeader b Keep-Alive: timeout=5, max=100
8 ObjProtocol c HTTP/1.1
8 ObjStatus c 200
8 ObjResponse c OK
8 ObjHeader c Content-Type: text/html; charset=utf-8
8 ObjHeader c Set-Cookie:
_fod_session
=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
%0ASGFzaHsGOg5yZXR1cm5fdG8iBi8GOgpAdXNlZHsGOwZG
--5181ccb5b65c2f75cafa4a6a89f0932ab07d1391; path=/
8 ObjHeader c X-Runtime: 2.06915
8 ObjHeader c ETag: "c10816a9ec10679b3ac800a4b2e3e70b"
8 ObjHeader c Served-by: prodapp5
8 ObjHeader c Cache-Control: no-cache, public, max-age=300
8 ObjHeader c Date: Wed, 03 Dec 2008 02:19:15 GMT
8 ObjHeader c Server: LiteSpeed
8 ObjHeader c Keep-Alive: timeout=5, max=100
9 BackendReuse b default
8 TTL c 353939895 RFC 300 1228270755 0 0 300 0
8 VCL_call c fetch
8 VCL_return c deliver
8 Length c 60261
8 VCL_call c deliver
8 VCL_return c deliver
8 TxProtocol c HTTP/1.1
8 TxStatus c 200
8 TxResponse c OK
8 TxHeader c Content-Type: text/html; charset=utf-8
8 TxHeader c X-Runtime: 2.06915
8 TxHeader c ETag: "c10816a9ec10679b3ac800a4b2e3e70b"
8 TxHeader c Cache-Control: no-cache, public, max-age=300
8 TxHeader c Server: LiteSpeed
8 TxHeader c Content-Length: 60261
8 TxHeader c Date: Wed, 03 Dec 2008 02:19:15 GMT
8 TxHeader c X-Varnish: 353939895
8 TxHeader c Age: 0
8 TxHeader c Via: 1.1 varnish
8 TxHeader c Served-by: prodweb9/prodapp5
8 TxHeader c Connection: close
8 ReqEnd c 353939895 1228270752.682591915
1228270755.543001890 0.000190020 2.860359192 0.000050783
0 StatAddr - 172.16.200.145 0 60 2 2 0 0 2 761 0
8 SessionClose c no request
8 StatSess c 172.16.200.145 56473 3 1 1 0 0 1 357 0
**** Requesting same url with compression
Curl Command:
$ curl http://prodweb9/ --head --compressed
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
X-Runtime: 2.06915
ETag: "c10816a9ec10679b3ac800a4b2e3e70b"
Cache-Control: no-cache, public, max-age=300
Server: LiteSpeed
Content-Length: 60261
Date: Wed, 03 Dec 2008 02:22:20 GMT
X-Varnish: 353939896 353939895
Age: 185
Via: 1.1 varnish
Served-by: prodweb9/prodapp5
Connection: close
Varnishlog output:
8 SessionOpen c 172.16.200.145 56529 :80
8 ReqStart c 172.16.200.145 56529 353939896
8 RxRequest c HEAD
8 RxURL c /
8 RxProtocol c HTTP/1.1
8 RxHeader c User-Agent: curl/7.16.3 (powerpc-apple-
darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
8 RxHeader c Host: prodweb9
8 RxHeader c Accept: */*
8 RxHeader c Accept-Encoding: deflate, gzip
8 VCL_call c recv
8 VCL_return c lookup
8 VCL_call c hash
8 VCL_return c hash
8 Hit c 353939895
8 VCL_call c hit
8 VCL_return c deliver
8 Length c 60261
8 VCL_call c deliver
8 VCL_return c deliver
8 TxProtocol c HTTP/1.1
8 TxStatus c 200
8 TxResponse c OK
8 TxHeader c Content-Type: text/html; charset=utf-8
8 TxHeader c X-Runtime: 2.06915
8 TxHeader c ETag: "c10816a9ec10679b3ac800a4b2e3e70b"
8 TxHeader c Cache-Control: no-cache, public, max-age=300
8 TxHeader c Server: LiteSpeed
8 TxHeader c Content-Length: 60261
8 TxHeader c Date: Wed, 03 Dec 2008 02:22:20 GMT
8 TxHeader c X-Varnish: 353939896 353939895
8 TxHeader c Age: 185
8 TxHeader c Via: 1.1 varnish
8 TxHeader c Served-by: prodweb9/prodapp5
8 TxHeader c Connection: close
8 ReqEnd c 353939896 1228270940.695084095
1228270940.695233107 0.009155035 0.000080824 0.000068188
0 StatAddr - 172.16.200.145 0 245 3 3 0 0 2 1130 0
8 SessionClose c no request
8 StatSess c 172.16.200.145 56529 0 1 1 0 0 0 369 0
---- Bounce Varnish again ----
Now request compressed page first:
$ curl http://prodweb9/ --head --compressed
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
X-Runtime: 1.96633
ETag: "d0c769c5047af7cef664e2f941011667"
Cache-Control: no-cache, public, max-age=300
Content-Encoding: gzip
Vary: Accept-Encoding
Server: LiteSpeed
Content-Length: 11576
Date: Wed, 03 Dec 2008 02:39:14 GMT
X-Varnish: 1723012051
Age: 0
Via: 1.1 varnish
Served-by: prodweb9/prodapp12
Connection: close
Varnishlog output:
8 SessionOpen c 172.16.200.145 56707 :80
8 ReqStart c 172.16.200.145 56707 1723012051
8 RxRequest c HEAD
8 RxURL c /
8 RxProtocol c HTTP/1.1
8 RxHeader c User-Agent: curl/7.16.3 (powerpc-apple-
darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
8 RxHeader c Host: prodweb9
8 RxHeader c Accept: */*
8 RxHeader c Accept-Encoding: deflate, gzip
8 VCL_call c recv
8 VCL_return c lookup
8 VCL_call c hash
8 VCL_return c hash
8 VCL_call c miss
8 VCL_return c fetch
9 BackendOpen b default 172.16.160.85 22005 172.16.160.174 80
8 Backend c 9 default default
9 TxRequest b GET
9 TxURL b /
9 TxProtocol b HTTP/1.1
9 TxHeader b User-Agent: curl/7.16.3 (powerpc-apple-
darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
9 TxHeader b Host: prodweb9
9 TxHeader b Accept: */*
9 TxHeader b Accept-Encoding: gzip
9 TxHeader b X-Varnish: 1723012051
9 TxHeader b X-Forwarded-For: 172.16.200.145
9 RxProtocol b HTTP/1.1
9 RxStatus b 200
9 RxResponse b OK
9 RxHeader b Content-Type: text/html; charset=utf-8
9 RxHeader b Set-Cookie:
_fod_session
=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
%0ASGFzaHsGOg5yZXR1cm5fdG8iBi8GOgpAdXNlZHsGOwZG
--5181ccb5b65c2f75cafa4a6a89f0932ab07d1391; path=/
9 RxHeader b X-Runtime: 1.96633
9 RxHeader b ETag: "d0c769c5047af7cef664e2f941011667"
9 RxHeader b Served-by: prodapp12
9 RxHeader b Cache-Control: no-cache, public, max-age=300
9 RxHeader b Content-Encoding: gzip
9 RxHeader b Vary: Accept-Encoding
9 RxHeader b Transfer-Encoding: chunked
9 RxHeader b Date: Wed, 03 Dec 2008 02:39:14 GMT
9 RxHeader b Server: LiteSpeed
9 RxHeader b Connection: Keep-Alive
9 RxHeader b Keep-Alive: timeout=5, max=100
8 ObjProtocol c HTTP/1.1
8 ObjStatus c 200
8 ObjResponse c OK
8 ObjHeader c Content-Type: text/html; charset=utf-8
8 ObjHeader c Set-Cookie:
_fod_session
=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
%0ASGFzaHsGOg5yZXR1cm5fdG8iBi8GOgpAdXNlZHsGOwZG
--5181ccb5b65c2f75cafa4a6a89f0932ab07d1391; path=/
8 ObjHeader c X-Runtime: 1.96633
8 ObjHeader c ETag: "d0c769c5047af7cef664e2f941011667"
8 ObjHeader c Served-by: prodapp12
8 ObjHeader c Cache-Control: no-cache, public, max-age=300
8 ObjHeader c Content-Encoding: gzip
8 ObjHeader c Vary: Accept-Encoding
8 ObjHeader c Date: Wed, 03 Dec 2008 02:39:14 GMT
8 ObjHeader c Server: LiteSpeed
8 ObjHeader c Keep-Alive: timeout=5, max=100
9 BackendReuse b default
8 TTL c 1723012051 RFC 300 1228271954 0 0 300 0
8 VCL_call c fetch
8 VCL_return c deliver
8 Length c 11576
8 VCL_call c deliver
8 VCL_return c deliver
8 TxProtocol c HTTP/1.1
8 TxStatus c 200
8 TxResponse c OK
8 TxHeader c Content-Type: text/html; charset=utf-8
8 TxHeader c X-Runtime: 1.96633
8 TxHeader c ETag: "d0c769c5047af7cef664e2f941011667"
8 TxHeader c Cache-Control: no-cache, public, max-age=300
8 TxHeader c Content-Encoding: gzip
8 TxHeader c Vary: Accept-Encoding
8 TxHeader c Server: LiteSpeed
8 TxHeader c Content-Length: 11576
8 TxHeader c Date: Wed, 03 Dec 2008 02:39:14 GMT
8 TxHeader c X-Varnish: 1723012051
8 TxHeader c Age: 0
8 TxHeader c Via: 1.1 varnish
8 TxHeader c Served-by: prodweb9/prodapp12
8 TxHeader c Connection: close
8 ReqEnd c 1723012051 1228271952.806010008
1228271954.783368111 0.000576019 1.977247953 0.000110149
0 StatAddr - 172.16.200.145 0 2 1 1 0 0 1 406 0
8 SessionClose c no request
8 StatSess c 172.16.200.145 56707 2 1 1 0 0 1 406 0
Now request uncompressed page...
$ curl http://prodweb9/ --head
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
X-Runtime: 0.54823
ETag: "309fb08bc00884c3b2d52449906da9b4"
Cache-Control: no-cache, public, max-age=300
Server: LiteSpeed
Content-Length: 60171
Date: Wed, 03 Dec 2008 02:39:36 GMT
X-Varnish: 1723012052
Age: 0
Via: 1.1 varnish
Served-by: prodweb9/prodapp5
Connection: close
Varnish log output:
8 SessionOpen c 172.16.200.145 56710 :80
8 ReqStart c 172.16.200.145 56710 1723012052
8 RxRequest c HEAD
8 RxURL c /
8 RxProtocol c HTTP/1.1
8 RxHeader c User-Agent: curl/7.16.3 (powerpc-apple-
darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
8 RxHeader c Host: prodweb9
8 RxHeader c Accept: */*
8 VCL_call c recv
8 VCL_return c lookup
8 VCL_call c hash
8 VCL_return c hash
8 VCL_call c miss
8 VCL_return c fetch
9 BackendClose b default
9 BackendOpen b default 172.16.160.85 22006 172.16.160.174 80
8 Backend c 9 default default
9 TxRequest b GET
9 TxURL b /
9 TxProtocol b HTTP/1.1
9 TxHeader b User-Agent: curl/7.16.3 (powerpc-apple-
darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
9 TxHeader b Host: prodweb9
9 TxHeader b Accept: */*
9 TxHeader b X-Varnish: 1723012052
9 TxHeader b X-Forwarded-For: 172.16.200.145
9 RxProtocol b HTTP/1.1
9 RxStatus b 200
9 RxResponse b OK
9 RxHeader b Content-Type: text/html; charset=utf-8
9 RxHeader b Set-Cookie:
_fod_session
=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
%0ASGFzaHsGOg5yZXR1cm5fdG8iBi8GOgpAdXNlZHsGOwZG
--5181ccb5b65c2f75cafa4a6a89f0932ab07d1391; path=/
9 RxHeader b X-Runtime: 0.54823
9 RxHeader b ETag: "309fb08bc00884c3b2d52449906da9b4"
9 RxHeader b Served-by: prodapp5
9 RxHeader b Cache-Control: no-cache, public, max-age=300
9 RxHeader b Content-Length: 60171
9 RxHeader b Date: Wed, 03 Dec 2008 02:39:36 GMT
9 RxHeader b Server: LiteSpeed
9 RxHeader b Connection: Keep-Alive
9 RxHeader b Keep-Alive: timeout=5, max=100
8 ObjProtocol c HTTP/1.1
8 ObjStatus c 200
8 ObjResponse c OK
8 ObjHeader c Content-Type: text/html; charset=utf-8
8 ObjHeader c Set-Cookie:
_fod_session
=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
%0ASGFzaHsGOg5yZXR1cm5fdG8iBi8GOgpAdXNlZHsGOwZG
--5181ccb5b65c2f75cafa4a6a89f0932ab07d1391; path=/
8 ObjHeader c X-Runtime: 0.54823
8 ObjHeader c ETag: "309fb08bc00884c3b2d52449906da9b4"
8 ObjHeader c Served-by: prodapp5
8 ObjHeader c Cache-Control: no-cache, public, max-age=300
8 ObjHeader c Date: Wed, 03 Dec 2008 02:39:36 GMT
8 ObjHeader c Server: LiteSpeed
8 ObjHeader c Keep-Alive: timeout=5, max=100
9 BackendReuse b default
8 TTL c 1723012052 RFC 300 1228271976 0 0 300 0
8 VCL_call c fetch
8 VCL_return c deliver
8 Length c 60171
8 VCL_call c deliver
8 VCL_return c deliver
8 TxProtocol c HTTP/1.1
8 TxStatus c 200
8 TxResponse c OK
8 TxHeader c Content-Type: text/html; charset=utf-8
8 TxHeader c X-Runtime: 0.54823
8 TxHeader c ETag: "309fb08bc00884c3b2d52449906da9b4"
8 TxHeader c Cache-Control: no-cache, public, max-age=300
8 TxHeader c Server: LiteSpeed
8 TxHeader c Content-Length: 60171
8 TxHeader c Date: Wed, 03 Dec 2008 02:39:36 GMT
8 TxHeader c X-Varnish: 1723012052
8 TxHeader c Age: 0
8 TxHeader c Via: 1.1 varnish
8 TxHeader c Served-by: prodweb9/prodapp5
8 TxHeader c Connection: close
8 ReqEnd c 1723012052 1228271975.969137907
1228271976.524655104 0.000959873 0.555464983 0.000052214
0 StatAddr - 172.16.200.145 0 24 2 2 0 0 2 764 0
8 SessionClose c no request
8 StatSess c 172.16.200.145 56710 1 1 1 0 0 1 358 0
What could be causing this? The only way to fix appears to be to add
the lines below:
sub vcl_hash {
if (req.http.Accept-Encoding ~ "gzip" || req.http.Accept-Encoding ~
"deflate") {
set req.hash += req.http.Accept-Encoding;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20081202/4d03bfe5/attachment-0001.html>
More information about the varnish-misc
mailing list