Need help?

Our experts will login to your server within 30 minutes to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price per month.

Disable Varnish cache – The right way!

Looking for a way to disable varnish cache?

The varnish is a caching web application that makes websites faster. However, Varnish cache can create problems during site edits or conflict with certain user-specific web pages. The best way to overcome its weakness is to disable the varnish cache.

At Bobcares, we often receive requests on the best way to disable varnish cache as part of our Server Management Services.

In this write-up, let’s see how our Support Engineers help customers to turn OFF caching.


Why do we Disable the Varnish cache?

Although the Varnish cache is very reliable, it still has its weaknesses. The biggest reliability can be attributed to its inability to deal with user-specific web pages.

User-specific pages have content that varies from one user to the other. Caching this kind of pages can be a threat to the clients’ security and privacy. In order to avoid sending the wrong information to the wrong people, varnish prevents caching these kinds of pages.

Also, there are sites that require login and registrations. They constantly update their data and content, which leads to Varnish’s next weakness.

Similarly, Varnish cache can be inconvenient for those editing their static web pages. Here, due to the cache, the changes may not reflect on the website.

During those situations, the only way out would be to disable varnish. Again, this can be temporary or permanent.


Methods of disabling cache

We just saw the various scenarios that demand cache disabling. Let’s now have a deep discussion on this topic and see how our Support Engineers disable it.


Disable varnish cache using .htaccess

This is one of the simplest and easily revertable methods.

Inserting the following line in .htaccess file in the public_html directory will prevent Varnish from caching the entire hosting service.

Header set Cache-Control "max-age=0, private, no-cache, no-store, must-revalidate"


Header add "disablevcache" "true"

Recently, one of our customers approached us with the request to disable varnish. When our Support Engineers tried to add the line in .htaccess file, they found that the file is missing. So, they created one in public_html and added the line in order to disable it.
If our customer needs to re-enable Varnish for their web hosting, we would remove the line from the .htaccess file.


Varnish cache disabling from the control panel

Popular control panels like cPanel allow disabling Varnish cache for the domain from the panel itself.

To do this, we login to the cPanel of the domain name that needs to disable Varnish.
Then we click on Manage Varnish under the Web Accelerator section. Here, we choose the Disable Varnish option.

disable varnish cache

Finally, we click on Confirm Action to enable it. That’s it.


Disable varnish cache in Ubuntu, CentOS or Red Hat

In Ubuntu, we disable varnish by changing the port from 8080 to 80. in the varnish configuration file. Our Support Engineers do this by following the steps below:

1.Open /etc/varnish/default.vcl and change the .port to 80 and restart the services.

Disable varnish cache

2.service varnish restart
3.service apache2 restart

If our customers are using CentOS or Red Hat then we run the command below for disabling.

service varnish stop

The above command stops the varnish cache service running. And if our customer needs to uninstall varnish cache, then we do that by running the command below.

yum erase varnish


[Having trouble in disabling Varnish cache errors? – Our Experts are available 24/7.]



In short, disabling the varnish cache is possible via the command-line and can be done in very few steps. In today’s write-up, we discussed this topic in detail and saw how our Support Engineers disable varnish cache.


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.


Submit a Comment

Your email address will not be published. Required fields are marked *