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:
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. 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:
- Access the Performance page at
/admin/config/development/performance
. In the Browser and Proxy cache maximum age field, select the value that you want to assign to the
max-age
header.
To configure the current Drupal version to use BigPipe rendering, see Enabling BigPipe rendering on Cloud Platform.
Cache settings in Drupal 7
On the Performance page at Configuration > Performance, set values for the following items:
- 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.