12
SessionOpen
c
172.16.26.1
50396
:8080
12
ReqStart
c
172.16.26.1
50396
668213522
12
RxRequest
c
GET
12
RxURL
c
/test.php
12
RxProtocol
c
HTTP/1.1
12
RxHeader
c
Host:
varnish.dev:8080
12
RxHeader
c
User-‐Agent:
Mozilla/5.0
(Macintosh;
U;
Intel
Mac
OS
X
10.6;
nl;
rv:1.9.2.10)
Gecko/20100914
Firefox/3.6.10
12
RxHeader
c
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/ *;q=0.8
12
RxHeader
c
Accept-‐Language:
nl,en-‐us;q=0.7,en;q=0.3
12
RxHeader
c
Accept-‐Encoding:
gzip,deflate
12
RxHeader
c
Accept-‐Charset:
ISO-‐8859-‐1,utf-‐8;q=0.7,*;q=0.7
12
RxHeader
c
Keep-‐Alive:
115
12
RxHeader
c
Connection:
keep-‐alive
12
RxHeader
c
Cookie:
PHPSESSID=2n2pkit81qdgk6k4trf1crft16
12
VCL_call
c
recv
12
VCL_return
c
pass
12
VCL_call
c
hash
12
VCL_return
c
hash
12
VCL_call
c
pass
12
VCL_return
c
pass
14
BackendClose
-‐
default
14
BackendOpen
b
default
127.0.0.1
34267
127.0.0.1
80
12
Backend
c
14
default
default
Telnet
management [email protected]:/#
telnet
localhost
6082 Trying
::1... Connected
to
localhost. Escape
character
is
'^]'. 200
154
-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐ Varnish
HTTP
accelerator
CLI. -‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐ Type
'help'
for
command
list. Type
'quit'
to
close
CLI
session.
Remove
GA
cookies sub
vcl_recv
{ if
(req.http.Cookie)
{
set
req.http.Cookie
=
regsuball(req.http.Cookie,"(^|;
)
*__utm.=[^;]+;?
*","\1");
if
(req.http.Cookie
==
"")
{
remove
req.http.Cookie;
} }
Add
cookies
to
hash sub
vcl_recv
{
if
(req.request
==
"GET"
||
req.request
==
"HEAD")
{
return
(lookup);
} } sub
vcl_hash
{
hash_data(req.http.cookie); } All
cookies
Director
for
load
balancing director
back
random
{
{.backend
=
default;
.weight=1;}
{.backend
=
other;
.weight=2;} } sub
vcl_recv
{
set
req.backend
=
back;
return(pass); }
Purge
&
vcl_hash Purge
only
works
with
the
standard
vcl_hash
implementa>on sub
vcl_hash
{
hash_data(req.url);
if
(req.http.host)
{
hash_data(req.http.host);
}
else
{
hash_data(server.ip);
}
return
(hash); }
ESI
VCL sub
vcl_recv
{
set
req.http.Surrogate-‐Capability="key=ESI/1.0"; } sub
vcl_fetch
{
if(beresp.http.Surrogate-‐Control~"ESI/1.0")
{
unset
beresp.http.Surrogate-‐Control;
set
beresp.do_esi=true;
} }