What is Varnish Cache, and can I disable it?

On x10Hosting, we use the Varnish cache server to help boost page loading times. Varnish will automatically cache both static and dynamic assets, so that they are served quicker to future page visits. All free hosting accounts have Varnish enabled by default, to speed up users' websites. The default caching time is 5 seconds for dynamic content and 5 minutes for static.

Disabling the cache

While Varnish is very useful for improving page loading times, the short delay created by the cache can sometimes be inconvenient for those who rely on their static pages updating immediately. Fortunately, disabling the caching is simple. Inserting the following line in your .htaccess file will prevent Varnish from caching your site.

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

You can add this line through the cPanel File Manager or through FTP.

If your .htaccess file does not yet exist, please create one in public_html. If you are using cPanel, you will need to enable the "Show hidden files (dotfiles)" checkbox, if it is not already checked.

Was this article helpful?