to the backend will have! # X-Forwarded-For set. If you use X-Forwarded-For and want to! # have it set for all requests, make sure to have:! # set bereq.http.connection = "close";! # here. It is not set by default as it might break some broken web # applications, like IIS with NTLM authentication.! return (pipe);! }! ! sub vcl_pass {! return (pass);! }! ! sub vcl_hash {! hash_data(req.url);! if (req.http.host) {! hash_data(req.http.host);! } else {! hash_data(server.ip);! }! return (hash);! }
11 ReqStart c 12.12.12.1 53727 1401010767 11 RxRequest c GET 11 RxURL c / 11 RxProtocol c HTTP/1.1 11 RxHeader c Host: 12.12.12.6 11 RxHeader c User-‐Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20100101 Firefox/17.0 11 RxHeader c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ *;q=0.8 11 RxHeader c Accept-‐Language: nl,en;q=0.7,fr-‐be;q=0.3 11 RxHeader c Accept-‐Encoding: gzip, deflate 11 RxHeader c Connection: keep-‐alive 11 VCL_call c recv lookup 11 VCL_call c hash 11 Hash c / 11 Hash c 12.12.12.6 11 VCL_return c hash 11 VCL_call c miss fetch 11 Backend c 13 default default 11 TTL c 1401010767 RFC 0 -‐1 -‐1 1357920021 0 1357920020 0 0 11 VCL_call c fetch 11 TTL c 1401010767 VCL 120 -‐1 -‐1 1357920021 -‐0 11 VCL_return c hit_for_pass 11 ObjProtocol c HTTP/1.1 11 ObjResponse c OK 11 ObjHeader c Date: Fri, 11 Jan 2013 16:00:20 GMT 11 ObjHeader c Server: Apache 11 ObjHeader c X-‐Powered-‐By: PHP/5.3.2-‐1ubuntu4.18 11 ObjHeader c Cache-‐Control: no-‐cache, no-‐store, max-‐age=0 Client
11 ObjProtocol c HTTP/1.1 11 ObjResponse c OK 11 ObjHeader c Date: Fri, 11 Jan 2013 16:00:20 GMT 11 ObjHeader c Server: Apache 11 ObjHeader c X-‐Powered-‐By: PHP/5.3.2-‐1ubuntu4.18 11 ObjHeader c Cache-‐Control: no-‐cache, no-‐store, max-‐age=0 11 ObjHeader c Vary: Accept-‐Encoding 11 ObjHeader c Content-‐Encoding: gzip 11 ObjHeader c Content-‐Length: 119 11 ObjHeader c Content-‐Type: text/html 11 Gzip c u F -‐ 119 336 80 80 887 11 VCL_call c deliver deliver 11 TxProtocol c HTTP/1.1 11 TxStatus c 200 11 TxResponse c OK 11 TxHeader c Server: Apache 11 TxHeader c X-‐Powered-‐By: PHP/5.3.2-‐1ubuntu4.18 11 TxHeader c Cache-‐Control: no-‐cache, no-‐store, max-‐age=0 11 TxHeader c Vary: Accept-‐Encoding 11 TxHeader c Content-‐Encoding: gzip 11 TxHeader c Content-‐Type: text/html 11 TxHeader c Content-‐Length: 119 11 TxHeader c Accept-‐Ranges: bytes 11 TxHeader c Date: Fri, 11 Jan 2013 16:00:20 GMT 11 TxHeader c X-‐Varnish: 1401010767 11 TxHeader c Age: 0 11 TxHeader c Via: 1.1 varnish 11 TxHeader c Connection: keep-‐alive 11 Length c 119 11 ReqEnd c 1401010767 1357920020.712090731 1357920020.727306366 0.000087738 Client
BackendOpen b default 127.0.0.1 51597 127.0.0.1 8080 13 TxRequest b GET 13 TxURL b / 13 TxProtocol b HTTP/1.1 13 TxHeader b Host: 12.12.12.6 13 TxHeader b User-‐Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20100101 Firefox/17.0 13 TxHeader b Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ *;q=0.8 13 TxHeader b Accept-‐Language: nl,en;q=0.7,fr-‐be;q=0.3 13 TxHeader b X-‐Forwarded-‐For: 12.12.12.1 13 TxHeader b X-‐Varnish: 1401010767 13 TxHeader b Accept-‐Encoding: gzip 13 RxProtocol b HTTP/1.1 13 RxStatus b 200 13 RxResponse b OK 13 RxHeader b Date: Fri, 11 Jan 2013 16:00:20 GMT 13 RxHeader b Server: Apache 13 RxHeader b X-‐Powered-‐By: PHP/5.3.2-‐1ubuntu4.18 13 RxHeader b Cache-‐Control: no-‐cache, no-‐store, max-‐age=0 13 RxHeader b Vary: Accept-‐Encoding 13 RxHeader b Content-‐Encoding: gzip 13 RxHeader b Content-‐Length: 119 13 RxHeader b Content-‐Type: text/html 13 Fetch_Body b 4(length) cls 0 mklen 1 13 Length b 119 13 BackendReuse b default Backend
= one; .weight=1; } { .backend = two; .weight=1; } } sub vcl_recv { set req.backend = localhosts; //Load balance by client IP, this is the default set client.identity = client.ip; } IP hash Uses client.identity
sub vcl_backend_response { if(beresp.http.Surrogate-‐Control~"ESI/1.0") { unset beresp.http.Surrogate-‐Control; set beresp.do_esi=true; } } Edge Side Includes in v4