Skip to content

Instantly share code, notes, and snippets.

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 aondio/1013f3599d0950f6de10d86af061a0fc to your computer and use it in GitHub Desktop.
Save aondio/1013f3599d0950f6de10d86af061a0fc to your computer and use it in GitHub Desktop.
varnishtest "implementing x-accel-redirect"
server s1 {
rxreq
expect req.url == "/s1"
txresp -hdr "X-Accel-Redirect: /s2"
rxreq
expect req.url == "/s2"
txresp
} -start
varnish v1 -vcl+backend {
sub vcl_deliver {
if (resp.http.X-Accel-Redirect) {
set req.url = resp.http.X-Accel-Redirect;
return (restart);
}
set resp.http.X-url = req.url;
}
} -start
client c1 {
txreq -url "/s1"
rxresp
expect resp.http.X-url == "/s2"
} -run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment