Commit 0f8e1083 authored by Lasse Karstensen's avatar Lasse Karstensen

Forgot code for handling redirects

parent c287db36
......@@ -21,7 +21,7 @@ varnish v1 -vcl+backend {
}
}
# standard Vary handling code from previous examples.
# Handle redirects, otherwise standard Vary handling code from previous examples.
sub vcl_fetch {
if (req.http.X-UA-Device) {
if (!beresp.http.Vary) { # no Vary at all
......@@ -29,6 +29,11 @@ varnish v1 -vcl+backend {
} elseif (beresp.http.Vary !~ "X-UA-Device") { # add to existing Vary
set beresp.http.Vary = beresp.http.Vary + ", X-UA-Device";
}
# will potentially show the extra address to the client. we don't want that.
# if the backend reorders the get parameters, you may need to be smarter here. (? and & ordering)
if (beresp.status == 301 || beresp.status == 302 || beresp.status == 303) {
set beresp.http.location = regsub(beresp.http.location, "[?&]devicetype=.*$", "");
}
}
set beresp.http.X-UA-Device = req.http.X-UA-Device;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment