<div dir="auto">Easy fix is: set it in vcl_deliver instead of vcl_backend_response.<div dir="auto"><br></div><div dir="auto">Have a look at builtin.vcl (varnishadm vcl.show -v boot) that gets automatically appended to your vcl. If you wish to bypass it, return(deliver) from your code and the built-in code won't be ran.<br><br><div data-smartmail="gmail_signature" dir="auto">-- <br>Guillaume Quintard </div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On May 9, 2017 14:00, "sreeranj s" <<a href="mailto:sreeranj4droid@gmail.com">sreeranj4droid@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div><br></div><div>Is it possible for varnish to send the "Cache-Control: no-cache, no-store, must-revalidate" cache control response to browser, while varnish caches the response.</div><div><br></div><div><br></div><div>Scenario is like this.</div><div><br></div><div>1) Backend sends cache control :Cache-Control: no-cache, no-store, must-revalidate</div><div>2) Varnish should cache the response.</div><div>3) Browser should not cache the contents so in response from varnish it should show </div><div>cache control :Cache-Control: no-cache, no-store, must-revalidate<br></div><div><br></div><div><br></div><div>I have tried using Cache-Control: no-cache, no-store, must-revalidate in set beresp.http.Cache-Control, but this causes varnish not to cache the responses.</div><div><br></div><div><br></div><div>Given below is the vcl_backend_response</div><div>=============================</div><div><div>sub vcl_backend_response {</div><div> if (bereq.url == "/") {</div><div> </div><div> unset beresp.http.expires;</div><div> unset beresp.http.set-cookie;</div><div> set beresp.ttl = 3600s;</div><div> set beresp.http.Cache-Control = "max-age=0";</div><div> #Prevent caching of 404 and 500 errors</div><div> if (beresp.status >= 400 && beresp.status <= 599) {</div><div> set beresp.ttl = 0s;</div><div> }</div><div> }</div><div>}</div></div><div>=============================<br></div><div><br></div><div>Any help is highly appreciated.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>
<br>______________________________<wbr>_________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/<wbr>lists/mailman/listinfo/<wbr>varnish-misc</a><br></blockquote></div></div>