<div dir="ltr"><div>Hello Guillaume,</div><div>We have made required changes at our end, but we have doubt on giving suitable TTL for uncacheable objects</div><div><br></div><div>if (beresp.http.Cache-Control ~ "no-cache") {<br>        set beresp.ttl = <b><font color="#ff0000">doubt</font></b>;<br>        set beresp.uncacheable = true;<br>}</div><div><br></div><div>FYI;</div><div>we have ttl of 24hrs for normal objects which are cacheable</div><div><br></div><div>May I know if there is any way to find the best possible TTL?<br></div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><font color="#666666"><i>Thanks & Regards,</i></font><div><font color="#666666"><i>Uday Kumar</i></font></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 28, 2024 at 7:07 PM Uday Kumar <<a href="mailto:uday.polu@indiamart.com" target="_blank">uday.polu@indiamart.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hello Guillaume,</div><div>Great to know about this, it should work for us!<br></div><div>will check this out</div><div dir="ltr"><br clear="all"><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><font color="#666666"><i>Thanks & Regards,</i></font><div><font color="#666666"><i>Uday Kumar</i></font></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 28, 2024 at 5:53 PM Guillaume Quintard <<a href="mailto:guillaume.quintard@gmail.com" target="_blank">guillaume.quintard@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Uday,</div><div><br></div><div>Sure, the classic practice will do nicely:</div><div><br></div><div>sub vcl_backend_response {</div><div>    if (beresp.http.that-specific-header) {</div><div>        # TTL should match the time during which that header is unlikely to change</div><div>        # do NOT set it to 0s or less (<a href="https://info.varnish-software.com/blog/hit-for-miss-and-why-a-null-ttl-is-bad-for-you" target="_blank">https://info.varnish-software.com/blog/hit-for-miss-and-why-a-null-ttl-is-bad-for-you</a>)<br></div><div>        set beresp.ttl = 2m;</div><div>        set beresp.uncacheable = true;</div><div>        return (deliver);<br></div><div>    }<br></div><div>}</div><div><br></div><div>The main trick here is beresp.uncacheable, you do not have to return immediately if you still have modifications/checks to do on that response.</div><div><br></div><div>Would that work for you?  </div><div><br></div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>-- <br></div><div>Guillaume Quintard<br></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 28, 2024 at 4:55 AM Uday Kumar <<a href="mailto:uday.polu@indiamart.com" target="_blank">uday.polu@indiamart.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello all,</div><div><br></div><div>We need to prevent caching in Varnish based on a specific header from the backend. </div><div><br></div><div>Could you please suggest the best approach to achieve this?<br></div><div><br></div><br clear="all"><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><font color="#666666"><i>Thanks & Regards,</i></font><div><font color="#666666"><i>Uday Kumar</i></font></div></div></div></div></div>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">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/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>
</blockquote></div></div>
</blockquote></div>