I'm not sure if this is something file_entity even has control over, or if supplemental modules are needed.

I am working on a site hosted on the Acquia Managed Cloud. The hosting architecture includes a Varnish cache.

When I replace a public file (e.g. a PDF file) in an existing File Entity with a file of the same name, the old file remains cached in Varnish until the cache expires. Is there a way to trigger invalidation of the Varnish cache entry when a file is replaced?


I'm not well versed enough in Varnish to know. Public files may also be a problem since they're served directly and Drupal cannot insert any type of headers into those responses.

Thanks! A short term solution for us may be to shorten the cache expiration times for files. Makes sense that public files would be purely under the control of Varnish and Apache (Drupal not involved).

Does anyone reading this know if there is any complementary module that will invalidate a varnish cache entry when a file entity is edited? Has anyone tried the expire module with File Entity?

I did get some advice from Acquia on this about using curl to send some purge headers from a command line. The purge headers are proprietary to the site, so I can't paste them here (nor would they be useful to anyone else anyway).

The command is along the lines of:

curl -X PURGE -H "(custom purge header)" -H "Accept-Encoding: gzip" http://yourdomain.example.com/sites/default/files/testdocument.pdf

Hey! What modules are you using in Drupal for your varnish setup? We use the expire and purge modules to automatically expire/purge paths. I recently wrote a patch for this which adds in the automatic expiration on files. It is now committed on the 7.x-2.x branch so I would highly recommend checking it out! It will expire the file paths on delete and update.


Status:Active» Fixed

From the request in #2 and the response in #5 it sounds like this is now fixed by using the latest versions of the expire and purge modules.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Issue summary:View changes

Clarified that Varnish is part of the hosting architecture I am using.