Skip to content

Instantly share code, notes, and snippets.

@rezan
Created February 11, 2020 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rezan/252929df43a6ae2cb69ad27b730251f7 to your computer and use it in GitHub Desktop.
Save rezan/252929df43a6ae2cb69ad27b730251f7 to your computer and use it in GitHub Desktop.
VTC with v1 routing to itself
varnishtest "VTC with v1 routing to itself"
# Start v1 with no VCL so we can get a addr and port
server s1 {} -start
varnish v1 -vcl+backend {} -start
varnish v1 -vcl+backend {
backend self
{
.host = "${v1_addr}";
.port = "${v1_port}";
}
sub vcl_recv
{
if (!req.http.self) {
set req.backend_hint = self;
set req.http.self = "true";
return (pass);
} else {
return (synth(200, "SELF"));
}
}
}
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.reason == "SELF"
} -run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment