varnish

warning: Creating default object from empty value in /home/tderycke/www/eldeto.com/modules/taxonomy/taxonomy.pages.inc on line 34.

Mobile device detection with Varnish

As I already have blogged before, if you are using Varnish as a page caching mechanism, Drupal cannot be used to detect the device that is visiting your website.

Already some examples have been created to detect devices in Varnish and add a header string that allows the Drupal backend to know about the device type.

This is just a small snippet that I use to redirect mobile users to a mobile url and desktop users to the desktop url.

# vcl_recv routine
sub vcl_recv {
  call device_detection;