Varnish caching

Varnish is a caching tool that can greatly increase website performance.

Varnish stores anonymous user connections and serves them from memory, instead of making requests to the web server. For this reason, Cloud Platform uses Varnish in front of its load balancers. For information about enabling your Cloud Platform website to use Varnish, see Using Varnish.

For Drupal 7, ensure that your site is not setting a SESS (session) cookie that invalidates Varnish caching on Cloud Platform. The Varnish module is not compatible with Cloud Platform.

By default, all static files are cached for one year as part of the standard Drupal installation. The standard Drupal .htaccess contains the following:

# Requires mod_expires to be enabled.
# Enable expirations.
ExpiresActive On
# Cache all files for 1 year after access.
ExpiresDefault "access plus 1 year"

If you manually purge a file from Varnish, you might see the new version of the file in your browser after one year.

To avoid viewing a cached version of the purged file:

  1. Upload a content file with a new file name.

    For example, append a number to the end of the file name.

  2. Replace the references of the old file name with the new file name.

By default, Cloud Platform Varnish does not cache the following:

  • SESSION cookies

  • HEAD or POST requests

  • Responses over 10 MB

Cloud Platform Varnish enforces a minimum caching policy of 15 minutes on HTTP 404 and 301 responses unless the backend provides for a higher value. If this is an undesirable behavior, contact Acquia Support.

Additional caching information

For more information about caching on your Drupal website, see Caching overview.

External resources