How to write VCL in varnish to do no caching

后端 未结 2 452
一向
一向 2021-01-26 06:55

I need to write VCL in Varnish so to prevent caching under certain conditions like cookie value.

Any idea how to do that?

相关标签:
2条回答
  • 2021-01-26 07:10

    Place the following inside your vcl_recv:

    # as soon as we have a NO_CACHE cookie pass request
    if (req.http.cookie ~ "NO_CACHE=") {
        return (pass);
    }
    
    0 讨论(0)
  • 2021-01-26 07:15

    Write and load your own .vcl file to instruct varnish when to cache. By default, requests with cookies will not be cached.

    You could start with the Varnish tutorial, and don't hesitate to ask a more specific question on this site if you can't make it work...

    0 讨论(0)
提交回复
热议问题