9gag-open-source/mobiledetect-varnish

Varnish VCL device-detect based on Mobile_Detect

0.2.0 2017-09-28 05:45 UTC

README

A tool to generate VCL function for Varnish using rules from Mobile_Detect.

Based on varnish-mobiletranslate.

Intended to be a drop-in replacement for devicedetect.

Installation

composer install 9gag-open-source/mobiledetect-varnish

Generating Varnish VCL

$generator = new \Detection\MobileDetect\Varnish\DeviceDetect();
echo $generator->generateVcl();

Using the VCL

Include the generated code in your Varnish VCL. The devicedetect function adds a X-UA-Device header to the request.

Device Type X-UA-Device
Phone mobile
Tablet tablet
Crawler bots bot
Other desktop