This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Self routing cluster example | |
vcl 4.0; | |
import directors; | |
backend node1 { | |
.host = "node1.example.com"; | |
.port = "80"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Self routing cluster example using 302 redirects | |
vcl 4.0; | |
import directors; | |
backend node1 { | |
.host = "node1.example.com"; | |
.port = "80"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishtest "Capture potential panic (sleep => gdb attach to pid)" | |
varnish v1 -cli "help" | |
shell "sleep 20" | |
server s1 { | |
rxreq | |
txresp | |
expect req.url == "/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishtest "Cache POSTs" | |
server s1 { | |
rxreq | |
txresp -body "resp_body" | |
expect req.url == "/" | |
expect req.method == "POST" | |
expect req.bodylen == 14 | |
} -start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Varnish Extend VOD Demo | |
vcl 4.0; | |
import std; | |
import fsbackend; | |
backend default { | |
.host = "origin-frankfurt.varnish-software.com"; | |
.port = "https"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.0; | |
import std; | |
backend default | |
{ | |
.host = "127.0.0.1"; | |
.port = "80"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub vcl_hash | |
{ | |
if (req.url ~ "xxx") { | |
set req.http.X-Accept-Encoding = req.http.Accept-Encoding; | |
hash_data(req.http.Accept-Encoding); | |
} | |
} | |
sub vcl_backend_fetch | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.0; | |
import cookie; | |
import std; | |
sub vcl_deliver | |
{ | |
cookie.parse(req.http.cookie); | |
set req.http.X-vcsid = cookie.get("_vcsid"); | |
if (req.http.X-vcsid == "") { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.0; | |
sub vcl_recv | |
{ | |
if (req.url == "/whoami.html") { | |
return(synth(765)); | |
} | |
} | |
sub vcl_synth |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vcl 4.0; | |
# Include this VCL on all tiers | |
# Call this once on the Edge tier | |
sub dvcl_init_edge | |
{ | |
unset req.http.X-DVCL-skip-grace; | |
} |