Skip to content

Instantly share code, notes, and snippets.

@tdonia
Created August 8, 2012 14:17
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 tdonia/3295367 to your computer and use it in GitHub Desktop.
Save tdonia/3295367 to your computer and use it in GitHub Desktop.
varnish mobile filter
# Rutine to try and identify device
sub identify_device {
# Default to thinking it's a PC
set req.http.X-Device = "pc";
if (req.http.User-Agent ~ "iP(hone|od)" || req.http.User-Agent ~ "Android" ) {
# It says its a iPhone, iPod or Android - so let's give them the touch-site..
set req.http.X-Device = "mobile";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment