Skip to content

Instantly share code, notes, and snippets.

@paullinney
Created June 15, 2014 02:53
Show Gist options
  • Save paullinney/bfd78f1c764ec7545ec4 to your computer and use it in GitHub Desktop.
Save paullinney/bfd78f1c764ec7545ec4 to your computer and use it in GitHub Desktop.
Varnish redirect based on cookie
vcl_recv {
if (!req.http.cookie ~ "site_intro" && !req.url ~ "^/intro" && !req.http.user-agent ~ "(?i)\biPhone.*Mobile.MobileDetect") {
error 750 "Moved Temporarily";
}
...
}
vcl_error {
if (obj.status == 750) {
set obj.http.Location = "/intro";
set obj.status = 302;
return(deliver);
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment