Varnish: cache only specific domain

前端 未结 3 1471
春和景丽
春和景丽 2021-01-31 21:20

I have been Googling aggressively, but without luck.

I\'m using Varnish with great results, but I would like to host multiple websites on a single server (Apache), witho

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-31 21:46

    Yes,

    in vcl_recv you just match the hosts that you would like not to cache and pass them. Something like this (untested):

    vcl_recv {
       # dont cache foo.com or bar.com - optional www
       if (req.host ~ "(www)?(foo|bar).com") {
         return(pass);
       }
    }
    

提交回复
热议问题