Skip to content

Instantly share code, notes, and snippets.

@jabley
Created January 5, 2011 15:55
Show Gist options
  • Save jabley/766489 to your computer and use it in GitHub Desktop.
Save jabley/766489 to your computer and use it in GitHub Desktop.
Varnish HTTP response
backend default {
set backend.host = "cdn.example.com";
set backend.port = "80";
}
## Called when a client request is received
#
sub vcl_recv {
set req.http.host = "cdn.example.com";
set req.http.port = "80";
lookup;
}
HTTP/1.1 200 OK
Server: Apache/2.2.3 (Red Hat)
Cache-Control: max-age=3600
Content-Type: video/3gpp
Content-Length: 1640697
Date: Wed, 05 Jan 2011 15:53:53 GMT
X-Varnish: 809366519
Age: 1
Via: 1.1 varnish
Connection: keep-alive
HTTP/1.1 200 OK
Server: Apache/2.2.3 (Red Hat)
Cache-Control: max-age=3600
Content-Type: video/3gpp
Content-Length: 1640697
Date: Wed, 05 Jan 2011 15:55:17 GMT
X-Varnish: 809368565
Age: 1
Via: 1.1 varnish
Connection: keep-alive
13443 SessionOpen c 192.168.1.1 64044
13443 ReqStart c 192.168.1.1 64044 809420791
13443 RxRequest c GET
13443 RxURL c /path/to/my/video
13443 RxProtocol c HTTP/1.1
13443 RxHeader c Host: cdn.example.com
13443 RxHeader c Accept: */*
13443 RxHeader c User-Agent: iPhone
13443 VCL_call c recv lookup
13443 VCL_call c hash hash
13443 Hit c 809410726
13443 VCL_call c hit deliver
13443 Length c 1640697
13443 VCL_call c deliver deliver
13443 TxProtocol c HTTP/1.1
13443 TxStatus c 200
13443 TxResponse c OK
13443 TxHeader c Server: Apache/2.2.3 (Red Hat)
13443 TxHeader c Cache-Control: max-age=3600
13443 TxHeader c Content-Type: video/3gpp
13443 TxHeader c Content-Length: 1640697
13443 TxHeader c Date: Wed, 05 Jan 2011 16:36:11 GMT
13443 TxHeader c X-Varnish: 809420791 809410726
13443 TxHeader c Age: 503
13443 TxHeader c Via: 1.1 varnish
13443 TxHeader c Connection: keep-alive
13443 ReqEnd c 809420791 1294245371.779422998 1294245391.416402102 0.000211954 0.000025988 19.636953115
13391 ReqStart c 192.168.1.2 51724 809418794
13391 RxRequest c GET
13391 RxURL c /path/to/my/video
13391 RxProtocol c HTTP/1.1
13391 RxHeader c Connection: Keep-Alive
13391 RxHeader c Host: cdn.example.com
13391 RxHeader c Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,image/png,*/*;q=0.5
13391 RxHeader c Accept-Charset: iso-8859-1,utf-8;q=0.7,*;q=0.7
13391 RxHeader c Accept-Encoding: gzip, deflate, x-gzip, identity; q=0.9
13391 RxHeader c Accept-Language: en
13391 RxHeader c User-Agent: Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 Nokia5233/21.1.004; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.5.2 3gpp-gba
13391 RxHeader c X-Nokia-MusicShop-Bearer: GPRS/3G
13391 RxHeader c X-Nokia-MusicShop-Version: 11.0944.15
13391 RxHeader c x-wap-profile: "http://nds1.nds.nokia.com/uaprof/Nokia5233r100-2G.xml "
13391 VCL_call c recv lookup
13391 VCL_call c hash hash
13391 Hit c 809410726
13391 VCL_call c hit deliver
13391 Length c 1640697
13391 VCL_call c deliver deliver
13391 TxProtocol c HTTP/1.1
13391 TxStatus c 200
13391 TxResponse c OK
13391 TxHeader c Server: Apache/2.2.3 (Red Hat)
13391 TxHeader c Cache-Control: max-age=3600
13391 TxHeader c Content-Type: video/3gpp
13391 TxHeader c Content-Length: 1640697
13391 TxHeader c Date: Wed, 05 Jan 2011 16:34:37 GMT
13391 TxHeader c X-Varnish: 809418794 809410726
13391 TxHeader c Age: 408
13391 TxHeader c Via: 1.1 varnish
13391 TxHeader c Connection: keep-alive
13391 ReqEnd c 809418794 1294245277.516757011 1294245392.056318998 0.359570980 0.000036955 114.539525032
13383 ReqStart c 192.168.1.3 59390 809419807
13383 RxRequest c GET
13383 RxURL c /path/to/my/video
13383 RxProtocol c HTTP/1.1
13383 RxHeader c Connection: Keep-Alive
13383 RxHeader c Host: cdn.example.com
13383 RxHeader c Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,image/png,*/*;q=0.5
13383 RxHeader c Accept-Charset: iso-8859-1,utf-8;q=0.7,*;q=0.7
13383 RxHeader c Accept-Encoding: gzip, deflate, x-gzip, identity; q=0.9
13383 RxHeader c Accept-Language: en
13383 RxHeader c User-Agent: Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 Nokia5233/21.1.004; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.5.2 3gpp-gba
13383 RxHeader c X-Nokia-MusicShop-Bearer: GPRS/3G
13383 RxHeader c X-Nokia-MusicShop-Version: 11.0944.15
13383 RxHeader c x-wap-profile: "http://nds1.nds.nokia.com/uaprof/Nokia5233r100-2G.xml "
13383 VCL_call c recv lookup
13383 VCL_call c hash hash
13383 Hit c 809410726
13383 VCL_call c hit deliver
13383 Length c 1640697
13383 VCL_call c deliver deliver
13383 TxProtocol
@jabley
Copy link
Author

jabley commented Jan 5, 2011

Initially all requests were going to the backend and it didn't look like Varnish was caching the response, despite the headers looking fine to me.

@jabley
Copy link
Author

jabley commented Jan 5, 2011

varnishlog -c -o RxURL /foo

The varnishlog output clearly shows that the entity has been cached and is being served by Varnish. Not sure what was going on there. Backend not changed, VCL not changed and pretty simple VCL at that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment