Loading...


Related Products


Date Published: March 14, 2022

Purge cached files in Varnish - D7 workaround

Acquia Purge does not purge static files from Varnish.  If static files are cached due to the following standard .htaccess code:

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On
 
  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600

And if files are:

  • Accessible via http and https.
  • Cached on both Acquia balancers.
  • Cached on several domains, including a CDN origin domain.

The following bash script can be used to purge files for Drupal 7 sites:

(modify the following variable to conform to your site: `bals`, `domains`, `protocols`, `path`)

bals="bal-59xx bal-59xx"
domains="supportforums.xxxxx.com cxx-test4.xxxx.com origin-supportforums.xxxxx.com"
protocols="http https"
path="/"$1
for bal in $bals
do
  for domain in $domains
  do
    for protocol in $protocols
    do
      url="$protocol://${bal}.prod.hosting.acquia.com${path}"
      echo $url $domain
      curl -k -sX PURGE -H "X-Acquia-Purge: xxxxsupport" -H "Accept-Encoding: gzip" -H "Host: $domain" $url | grep -i title
    done
  done
done

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation