This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

📣 Join our live AMA on the Future of Page Builders with Brizy's CEO! Register Now →

Introducing Varnish Enhancements: Device Detection & More

Updated on November 10, 2023

4 Min Read
Varnish Updates

What if we could take caching a step further and optimize it? We’re excited to announce the enhancement of the Varnish Cache offering on Cloudways with the launch of location-based & device-based caching as well as the ability to ignore query string parameters with Varnish.

What is Varnish

Varnish is a potent tool that can supercharge your website’s speed and deliver a seamless browsing experience to your users. Without Varnish, your web server lacks an efficient HTTP reverse proxy cache, resulting in increased server resource utilization, longer page load times, and potential scalability issues.

The Problem We Set Out to Solve

Our Varnish implementation has always been great at speeding up load times. However, there were some specific cases that we haven’t been able to cater to, until now that is.

One such case was of websites with different layouts depending on the device. E.g. a different design for mobile users vs tablet users vs desktop users. Since our Varnish configuration was unable to differentiate between devices, only one of these versions would get the cache, typically the desktop version & served to all users regardless of device type.

While this didn’t cause any issues for websites with mobile-responsive designs, those with separately designed web pages for each device suffered in terms of usability.

Additionally, the use of query strings for tracking purposes resulted in Varnish detecting each visit to the URL e.g.

URL 1:

URL 2:

As separate webpages, instead of serving the webpage from the cache, they would be compiled from scratch on the server end, thus increasing server load & resulting in less optimal load times.

A similar issue would happen in the case of 404 pages. Since these were detected to not exist & hence not cached, the request would get sent to the server end, thus also contributing to server load.

Lastly, various Varnish VCL (Varnish Configuration Language) issues, including the WordPress_test cookie problem, redundant code, and URL purge errors, affected the previous implementation.

The Solution

At Cloudways, our focus has always been on creating solutions that not only provide you with optimal performance but also provide you with control.

This is why for the first 2 problems, the solutions created i.e. Device Detection, & Ignore Query String, can be toggled on & off through the application settings menu for each application.

Device Detection: A Device-Based Caching Solution

Enabling Device Detection from Application settings will allow Varnish to determine which device users are browsing from. Varnish will then cache web page versions for each device type & serve them appropriately, greatly decreasing load times while improving the user experience for your end users.

These implementations allow you to get the most out of your servers, reducing the need for additional server resources.

Note: If your website design supports desktop, tablet, and mobile browsers with the same responsive HTML/CSS markup, then device-based caching is not required.

Understanding the “Ignore Query String” Feature

The “Ignore Query String” feature allows you to control how social media query parameters in URLs are handled. When enabled, our caching layer i.e. Varnish, “Ignores” the query string part of each request.

For example:

If the URLs were as follows with query strings;

URL 1:

URL 2:

Varnish would ignore the query strings & treat each as;


Thus Varnish would detect each request as leading to the same webpage, & serve the same from the cache rather than having the server compile each from scratch. This is useful in cases where you want to serve the same content regardless of the specific parameters in the query string. This works for the following query string types:

# Query Strings
1 msclkid
2 gclid
3 dm_i
4 qid
5 mc_eid
6 mc_cid
7 fbclid
8 cx
9 ie
10 cof
11 siteurl
12 zanpid
13 origin
14 utm_[a-z]+
15 mr:[A-z]+

However, it should be noted that while this does improve load times & ensure a consistent user experience, it may cause issues with tracking software while also removing the impact of any & all personalizations based on tracking parameters.

This means that tracking data from certain social media campaigns (depending on the platform) may be consolidated, and you won’t be able to distinguish between individual campaign sources within your analytics.

You can learn more about the Ignore Query String functionality Here.

Conclusion: Balancing Efficiency and Tracking

In summary, some weaknesses of the old Varnish implementation were evident, and we are actively working to overcome these challenges by introducing new features, re-enabling crucial options, and making necessary bug fixes. With these updates, we aim to provide a better, more user-friendly caching solution that meets the evolving needs of our valued customers.

Device-based caching with Varnish is an indispensable technique for elevating the performance of non-responsive websites. By tailoring your caching strategy to accommodate the distinctive needs of various devices, you can deliver faster loading times, an improved user experience, and improve your SEO rankings.

With the correct configuration and vigilant monitoring, Varnish empowers you to offer a seamless and lightning-fast web experience for all users, regardless of the device they employ to access your site.

As with any web optimization feature, a thoughtful approach that aligns with your specific goals and needs is essential. By harnessing the power of “Ignore Query String” judiciously, you can supercharge your website’s performance and provide a stellar user experience while keeping a close eye on your campaign metrics.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Inshal Ali

Inshal is a Content Marketer at Cloudways. With background in computer science, skill of content and a whole lot of creativity, he helps business reach the sky and go beyond through content that speaks the language of their customers. Apart from work, you will see him mostly in some online games or on a football field.


Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!


Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour


  • 0


  • 0


  • 0


  • 0



For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now