How to write VCL in varnish to do no caching

房东的猫 提交于 2019-12-20 06:18:07

问题


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

Any idea how to do that?


回答1:


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...




回答2:


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);
}


来源:https://stackoverflow.com/questions/9478986/how-to-write-vcl-in-varnish-to-do-no-caching

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!