We're using varnish to proxy/cache content on 2 web servers running drupal. With that said, everything seems to be up and in order, pages are being cached, drupal is able to make the purge request and so forth. However, we're seeing an odd issue that when you bring up the page and do a hard refresh (shift+refresh) we get a 'Error 200 Purged' being reported back. This only occurs on the hard refreshes. A subsequent refresh will bring the page back.

The config is a simple purge block per common documentation. What might we be doing wrong here such that hard refreshes are causing this error?

# Allow purging
if (req.method == "PURGE") {
    if (!client.ip ~ purge) {
        # Return Error 405 if not allowed.
        return (synth(405, "Forbidden - Not allowed."));

   return (purge);

Error on shift+refresh:

Error 200 Purged

Thank you in advance for any direction on this matter.


After speaking with Reza on the Varnish IRC channel it appears I had a chunk of code in there that was both broken and insecure. The chunk was:

if (req.http.Cache-Control ~ "(?i)no-cache") {
   # http://varnish.projects.linpro.no/wiki/VCLExampleEnableForceRefresh
   # Ignore requests via proxy caches and badly behaved crawlers
   # like msnbot that send no-cache with every request.
       if (! (req.http.Via || req.http.User-Agent ~ "(?i)bot" || req.http.X-Purge)) {
           #set req.hash_always_miss = true; # Doesn't seems to refresh the object in the cache
           return(purge); # Couple this with restart in vcl_purge and X-Purge header to avoid loops

After removing everything is working as intended. Thanks Reza

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.