Information for: DEVELOPERS   PARTNERS

Manually purging a page from Varnish cache


Acquia strongly recommends using the preferred method of Varnish® cache purging, Acquia Purge. For more details, see Purging Varnish cache on Acquia Cloud.

Varnish caching is intended to provide protection for your application, and will continue to provide content for your users in some cases even if your application is down for a short period. Sometimes this means that you have content that you may need to remove more quickly than the standard Varnish timeout for your application. Two methods you can use to clear your Varnish cache are Acquia Purge and by using command line instructions.

Command line

If you must use the command line to manually purge the Varnish cache for a specific page, the easiest and most straightforward way is to manually purge the page using cURL with the regular -X PURGE request method to interact with the HTTP server. Next, pass it to Acquia’s custom X-Acquia-Purge header with the Unix site name from which to purge the specified page.

Connect to one of your Acquia web servers using SSH and run one of the following commands. Replace [sitename] with your Unix site name and the path with either your front page or any page you wish to clear from the Varnish cache. It is often useful to purge both a given path and its related RSS feed, if there is any (rss.xml by default). You will need to run this command for each page that you want to purge from the Varnish cache, since there is no way to pass it a list of pages to purge all at once.


  • These commands will not work with the domains that are provisioned with Acquia Cloud environments.
  • Acquia Cloud Site Factory subscribers must use the command to ignore the balancer’s SSL state.
  • If you are not using an elastic load balancer (ELB):

    # Replace 'sitename' below with the appropriate value.
    curl -X PURGE -H "X-Acquia-Purge:sitename" -H "Accept-Encoding: gzip"
  • If your application uses an ELB, you must send requests to each active balancer, using the desired domain as a Host header.

    If you are trying to purge a page on, and that domain is hosted on bal-1234 and bal-1235 in the devcloud realm, you would use the following:

    curl -X PURGE -H "X-Acquia-Purge:[sitename]" --compress -H "Host:"
    curl -X PURGE -H "X-Acquia-Purge:[sitename]" --compress -H "Host:"``

    To do this for your own servers, replace with the appropriate server and realm. You can find the full list on the environment’s Servers webpage.

  • If your application is behind a content delivery network (CDN), such as Akamai, you must send a request to the active load balancer or the balancer’s Elastic IP Address (EIP). To do this, use a command similar to the following:

    curl -X PURGE -H "X-Acquia-Purge:[sitename]" -H "Accept-Encoding: gzip" -H "Host:" http://[eip_address]

    Your [eip_address] is located on your Acquia Cloud Servers page.

  • If your website redirects all traffic from HTTP to HTTPS, you may need to ignore the balancer’s SSL state, and explicitly specify the HTTPS protocol, as follows:

    curl -k -X PURGE -H "X-Acquia-Purge:mysite" --compress -H "Host:"


    Acquia Cloud Site Factory subscribers must use this version of the command, replacing prod with the appropriate realm. If you need assistance determining the correct realm for your subscription, contact Acquia Support.


It is important to understand that the Varnish cache is stored per domain, so if multiple domains are configured to reference the same application (for example, and, you need to make individual curl requests for each domain on which the page to be cleared is referenced.

It is also important to understand that running these purge commands will not invalidate Drupal caches. If Drupal cache objects are not yet scheduled to be purged from the cache and Memcache, purging the Varnish cache will not make any difference. Because of this, you will have to think of a way to clear the relevant CID (cache id) for the cache objects you need to purge first.

We recommend that you leverage Drupal’s cache_clear_all API function in a Rule or a custom module to specifically clear the cache items that are going to be triggered by the Varnish cache purge.


We strongly recommend against simply clearing all Drupal caches, because it will have consequences for how the application performs during the cache rebuilding phase.

For more information about the different layers of caching, see the Caching overview page.