Skip to content

Instantly share code, notes, and snippets.

@gquintard gquintard/301-1.vtc
Created Dec 18, 2016

Embed
What would you like to do?
varnishtest "30X redirections"
server s1 {}
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.http.host != "www.varnish-software.com") {
set req.http.location = "https://www.varnish-software.com/";
return(synth(301));
}
}
sub vcl_synth {
if (resp.status == 301 || resp.status == 302) {
set resp.http.location = req.http.location;
return (deliver);
}
}
} -start
client c1 {
txreq -hdr "host: varnish"
rxresp
expect resp.status == 301
expect resp.http.location == "https://www.varnish-software.com/"
expect resp.reason == "Moved Permanently"
} -run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.