Varnish that Site

Varnish Cache logoSo you want to serve smartphone-optimized HTML pages to your mobile users – and you want them served fast?

Simply install Varnish and let it do device-type detection and caching for you! Just follow these few steps:

1. Install Varnish from  https://www.varnish-cache.org/

2. Add https://github.com/varnish/varnish-devicedetect/blob/master/devicedetect.vcl to your default.vcl file

3. Add the code below to the beginning of the vcl_recv function:

4. Finally, add this code to the beginning of the vcl_hash function:

Now you can use the “X-UA-Device” request header in your app server to automatically detect desktops, tablets, and mobile phones and build HTML code optimized for each device type!

1 thought on “Varnish that Site

Comments are closed.