---
title: "Configuring Drupal cache settings for Varnish"
date: "2024-02-14T06:18:38+00:00"
summary: "Optimize your Drupal site's performance with Varnish caching. Learn how to configure cache settings for different Drupal versions, including Site Factory, to enhance speed and user experience."
image:
type: "page"
url: "/acquia-cloud-platform/configuring-drupal-cache-settings-varnish"
id: "522ca6fb-4dc2-40da-8182-48c7d87a2cf7"
---

You must configure your Drupal application to take advantage of Varnish®. To set your website’s cache options to external caching, open your Drupal application’s **Performance** page. The cache settings depend on your version of Drupal:

Note for Site Factory users

Changing Site Factory caching settings requires you to create a [post-settings.php hook](/site-factory/manage/website/cache/modify).

Cache settings in the current Drupal version
--------------------------------------------

On the Performance page at `/admin/config/development/performance`, select an option from the **Page cache maximum age** list. This value sets the maximum time a page can stay in the Varnish cache for an application running the [current Drupal version](/service-offerings/guide/software-life-cycle#supported-drupal-version). Selecting **<no caching>** sets the `max-age` value to 0, which means assets are never cached. A reasonable value is **6 hours** to **12 hours**.

On the Performance page, the only setting that affects the Varnish cache is the **Browser and Proxy cache maximum age** field. Use this field to configure the maximum time a page can stay in the Varnish cache.

To change the configuration:

1.  Access the Performance page at `/admin/config/development/performance`.
2.  In the **Browser and Proxy cache maximum age** field, select the value that you want to assign to the `max-age` header.
    
    Note
    
    Click **Clear all caches** to clear all caches that belong to your Drupal application.
    
    ![Drupal 9 cache settings page](https://acquia.widen.net/content/485a7cb5-a4de-4f37-9633-3c966cd83682/web/cloud-platform_drupal-9-cache-settings.png)
    

To configure the [current Drupal version](/service-offerings/guide/software-life-cycle#supported-drupal-version) to use BigPipe rendering, see [Enabling BigPipe rendering on Cloud Platform](/acquia-cloud-platform/performance/bigpipe#cloud-bigpipe-enable).

Cache settings in Drupal 7
--------------------------

On the Performance page at **Configuration** > **Performance**, set values for the following items:

![cloud-platform_drupal-7-cache-settings.png](https://acquia.widen.net/content/1ceebf40-84e9-4d38-b4ad-36284ccfb81f/web/cloud-platform_drupal-7-cache-settings.png?w=480&itok=Vaem_vJm)

*   Select the **Cache pages for anonymous users** checkbox.
*   Use the **Minimum cache lifetime** field with caution. The minimum cache lifetime prevents Drupal from clearing page and block caches for a set period of time after you change the content of nodes or blocks. This setting can cause unexpected behavior when editing content or using an external cache such as Varnish. If you are unsure, leave the minimum cache lifetime set to **0**.
*   Use the **Expiration of cached pages** field to set the maximum time for which a page can stay in the Varnish cache. By setting this value to **<none>**, the `max-age` header Drupal sends to Varnish is 0, which means the page will not be cached. A reasonable expiration setting is from **6 hours** to **12 hours**.

Important

For Drupal 7 and earlier versions, Acquia strongly recommends you do not compress cached pages, as compression can cause problems with both Varnish caching and New Relic application monitoring.