Varnish Cache is a caching reverse proxy that is installed in front of all Acquia Cloud load balancing servers. Varnish is configured with its own domain-specific programming language, VCL (Varnish Configuration Language). If you are interested in deploying a custom Varnish configuration, Acquia Ready can provide one or more of several standard VCL modifications that require minimal customization, and can also assist with the deployment and testing process.
Types of custom Varnish templates
The Acquia Ready team has pre-written templates to address common custom VCL use cases. The current list of provided custom VCL templates that we provide include the following:
- Hash on device string - This is an edge-case mobile strategy. Customers implement hashes on device strings when they do not want to do redirects to a mobile- and/or tablet-specific subdomain, and they do not have a responsive theme.
- Hash on cookie value - This is an edge-case strategy where customers want to serve different content on a single URL to anonymous traffic, based on a cookie value. Acquia strongly discourages cookie-dependent architectures for reasons similar to those previously listed.
- IP whitelisting - Customers can ask for IP whitelisting when they want to ensure that their website can be accessed only from certain IP addresses. Some customers insist on having it in the VCL due to perceived performance consequences related to doing the whitelisting in
.htaccess. Acquia's recommended strategy is to implement whitelisting in
.htaccess, or similar.
- Alternative Backend - There is an alternative using Apache's
mod_proxywhich does not require a custom VCL.
Some of these use cases may require customer-specific modifications. The Acquia Ready team will handle these modifications, for up to one hour of work.
When custom VCL is not the best solution
It should be verified that a custom VCL is indeed the only solution to a customer's feature requirements. A Custom VCL is not the best solution in the following circumstances:
- Redirects - Acquia strongly discourages implement redirects in a Custom VCL, due to the inherently long test and deployment cycle. For small numbers of redirects, instead use either
.htaccessor the Drupal Redirect module.
- Edge Side Includes (ESI) - ESIs enable Varnish to assemble HTTP responses by fetching multiple objects from either cache or backends. Current versions of Varnish (4.x or greater) and Drupal (8.x or greater) do not respond well with ESI, and its use is discouraged in the strongest terms.
- Customize Cache headers - Some use cases warrant the modification of default cache headers, depending on variables such as URL or user agent. This can be done effectively in both
settings.phpor widely used contrib modules.
- Access restrictions - Various solutions exist.
- Vary Cache - Acquia's default Varnish template will vary its cache content only with
Session Cookie. Customers may have reasons that require these variations for unauthenticated users not be mixed in the cache — for example, additional cookies and/or headers such as
ACCEPT-LANGUAGEor custom headers. Often, this involves only a small subset of easily identifiable requests. Before resorting to a Custom VCL, investigate what would occur if these exceptions were not cached by Varnish.
The following are out of scope for the Acquia Ready offering and require a Professional Services engagement:
- Combinations of the customizations listed
- VCL work for self-hosted customers