Varnish web site optimization

blackandcode's picture

Hello everybody

I'm new to Balkan group. I have one question regarding optimizing site with Varnish. I have installed varnish and Expire modules and setup them. They are working very well but I have one problem regarding deleting cache from varnish.

The problem is how to delete varnish cache only for index(home) page and not to delete cache for other pages. I look at he varnish log and I found that whole varnish cache is deleted every time Drupal executes command

ban ~ && req.url ~ "/"

This command is executed by varnish module or expire module.

So the question is how to fix this? How can I delete only cache on home page?


Have you looked at the Cache

Ivan Zugec's picture

Have you looked at the Cache Expiration ( module. I remember a presentation where the presenter said they used this module to purge specific page from Varnish over the administrative socket.

Try out the module.

We've been using Varnish on

slashrsm's picture

We've been using Varnish on Drupal 7 in production for about a year now. We are using Varnish module to handle clears and it works OK.

We have some custom logic also, that call function in varnish.module to execute bans.

Your ban command looks OK. Maybe you should check what host is beeing used to save pages. It is not the same if you ban or And I am not sure that you can use wildcard on host, so you should config your setup to only use one I guess.

Janez Urevc - software engineer @ - @slashrsm -

Varnish web site optimization - Solution

blackandcode's picture

Thanks for answers! But unfortunately they didn't help me a lot. At the end I revised all used modules:

  1. Varnish
  2. Expire module

And changed their code a little bit. They had a few bugs. Now site is working very good