Skip to content

Commit

Permalink
Modify URL after vcl_hash, so that purge works as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasse Karstensen committed Mar 8, 2012
1 parent 2884214 commit 8d1aa8b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/073-example3.vtc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ server s1 {

varnish v1 -vcl+backend {
include "${projectdir}/../devicedetect.vcl";
sub vcl_recv {
call devicedetect;
sub vcl_recv { call devicedetect; }

sub append_ua {
if ((req.http.X-UA-Device) && (req.request == "GET")) {
# if there are existing GET arguments;
if (req.url ~ "\?") {
Expand All @@ -21,6 +22,10 @@ varnish v1 -vcl+backend {
}
}

# do this after vcl_hash, so all Vary-ants can be purged in one go. (avoid ban()ing)
sub vcl_miss { call append_ua; }
sub vcl_pass { call append_ua; }

# Handle redirects, otherwise standard Vary handling code from previous examples.
sub vcl_fetch {
if (req.http.X-UA-Device) {
Expand Down

0 comments on commit 8d1aa8b

Please sign in to comment.