Re: Preventing Caching in Varnish Based on Backend Response Header

2024-06-12 Thread Uday Kumar
Noted.

Thanks for suggestion

*Thanks & Regards,*
*Uday Kumar*


On Tue, Jun 11, 2024 at 10:35 PM Guillaume Quintard <
guillaume.quint...@gmail.com> wrote:

> Hi,
>
> Don't worry too much about it. Uncacheable objects take a minimal amount
> of space in the cache, and if an object suddenly becomes cacheable, you can
> insert it in the cache, pushing the uncacheable version out.
>
> I'd say keep 24 hours and worry about big stuff :-)
>
> Cheers,
>
> --
> Guillaume Quintard
>
>
> On Tue, Jun 11, 2024 at 4:22 AM Uday Kumar 
> wrote:
>
>> May I know if there is any way to find the best possible TTL?
>> I meant to ask for uncacheable objects
>>
>> *Thanks & Regards,*
>> *Uday Kumar*
>>
>>
>> On Tue, Jun 11, 2024 at 4:11 PM Uday Kumar 
>> wrote:
>>
>>> Hello Guillaume,
>>> We have made required changes at our end, but we have doubt on giving
>>> suitable TTL for uncacheable objects
>>>
>>> if (beresp.http.Cache-Control ~ "no-cache") {
>>> set beresp.ttl = *doubt*;
>>> set beresp.uncacheable = true;
>>> }
>>>
>>> FYI;
>>> we have ttl of 24hrs for normal objects which are cacheable
>>>
>>> May I know if there is any way to find the best possible TTL?
>>>
>>> *Thanks & Regards,*
>>> *Uday Kumar*
>>>
>>>
>>> On Tue, May 28, 2024 at 7:07 PM Uday Kumar 
>>> wrote:
>>>
 Hello Guillaume,
 Great to know about this, it should work for us!
 will check this out

 *Thanks & Regards,*
 *Uday Kumar*


 On Tue, May 28, 2024 at 5:53 PM Guillaume Quintard <
 guillaume.quint...@gmail.com> wrote:

> Hi Uday,
>
> Sure, the classic practice will do nicely:
>
> sub vcl_backend_response {
> if (beresp.http.that-specific-header) {
> # TTL should match the time during which that header is
> unlikely to change
> # do NOT set it to 0s or less (
> https://info.varnish-software.com/blog/hit-for-miss-and-why-a-null-ttl-is-bad-for-you
> )
> set beresp.ttl = 2m;
> set beresp.uncacheable = true;
> return (deliver);
> }
> }
>
> 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.
>
> Would that work for you?
>
> --
> Guillaume Quintard
>
>
> On Tue, May 28, 2024 at 4:55 AM Uday Kumar 
> wrote:
>
>> Hello all,
>>
>> We need to prevent caching in Varnish based on a specific header from
>> the backend.
>>
>> Could you please suggest the best approach to achieve this?
>>
>>
>> *Thanks & Regards,*
>> *Uday Kumar*
>> ___
>> varnish-misc mailing list
>> varnish-misc@varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>
>
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Re: Preventing Caching in Varnish Based on Backend Response Header

2024-06-11 Thread Guillaume Quintard
Hi,

Don't worry too much about it. Uncacheable objects take a minimal amount of
space in the cache, and if an object suddenly becomes cacheable, you can
insert it in the cache, pushing the uncacheable version out.

I'd say keep 24 hours and worry about big stuff :-)

Cheers,

-- 
Guillaume Quintard


On Tue, Jun 11, 2024 at 4:22 AM Uday Kumar  wrote:

> May I know if there is any way to find the best possible TTL?
> I meant to ask for uncacheable objects
>
> *Thanks & Regards,*
> *Uday Kumar*
>
>
> On Tue, Jun 11, 2024 at 4:11 PM Uday Kumar 
> wrote:
>
>> Hello Guillaume,
>> We have made required changes at our end, but we have doubt on giving
>> suitable TTL for uncacheable objects
>>
>> if (beresp.http.Cache-Control ~ "no-cache") {
>> set beresp.ttl = *doubt*;
>> set beresp.uncacheable = true;
>> }
>>
>> FYI;
>> we have ttl of 24hrs for normal objects which are cacheable
>>
>> May I know if there is any way to find the best possible TTL?
>>
>> *Thanks & Regards,*
>> *Uday Kumar*
>>
>>
>> On Tue, May 28, 2024 at 7:07 PM Uday Kumar 
>> wrote:
>>
>>> Hello Guillaume,
>>> Great to know about this, it should work for us!
>>> will check this out
>>>
>>> *Thanks & Regards,*
>>> *Uday Kumar*
>>>
>>>
>>> On Tue, May 28, 2024 at 5:53 PM Guillaume Quintard <
>>> guillaume.quint...@gmail.com> wrote:
>>>
 Hi Uday,

 Sure, the classic practice will do nicely:

 sub vcl_backend_response {
 if (beresp.http.that-specific-header) {
 # TTL should match the time during which that header is
 unlikely to change
 # do NOT set it to 0s or less (
 https://info.varnish-software.com/blog/hit-for-miss-and-why-a-null-ttl-is-bad-for-you
 )
 set beresp.ttl = 2m;
 set beresp.uncacheable = true;
 return (deliver);
 }
 }

 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.

 Would that work for you?

 --
 Guillaume Quintard


 On Tue, May 28, 2024 at 4:55 AM Uday Kumar 
 wrote:

> Hello all,
>
> We need to prevent caching in Varnish based on a specific header from
> the backend.
>
> Could you please suggest the best approach to achieve this?
>
>
> *Thanks & Regards,*
> *Uday Kumar*
> ___
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>

___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Re: Preventing Caching in Varnish Based on Backend Response Header

2024-06-11 Thread Uday Kumar
May I know if there is any way to find the best possible TTL?
I meant to ask for uncacheable objects

*Thanks & Regards,*
*Uday Kumar*


On Tue, Jun 11, 2024 at 4:11 PM Uday Kumar  wrote:

> Hello Guillaume,
> We have made required changes at our end, but we have doubt on giving
> suitable TTL for uncacheable objects
>
> if (beresp.http.Cache-Control ~ "no-cache") {
> set beresp.ttl = *doubt*;
> set beresp.uncacheable = true;
> }
>
> FYI;
> we have ttl of 24hrs for normal objects which are cacheable
>
> May I know if there is any way to find the best possible TTL?
>
> *Thanks & Regards,*
> *Uday Kumar*
>
>
> On Tue, May 28, 2024 at 7:07 PM Uday Kumar 
> wrote:
>
>> Hello Guillaume,
>> Great to know about this, it should work for us!
>> will check this out
>>
>> *Thanks & Regards,*
>> *Uday Kumar*
>>
>>
>> On Tue, May 28, 2024 at 5:53 PM Guillaume Quintard <
>> guillaume.quint...@gmail.com> wrote:
>>
>>> Hi Uday,
>>>
>>> Sure, the classic practice will do nicely:
>>>
>>> sub vcl_backend_response {
>>> if (beresp.http.that-specific-header) {
>>> # TTL should match the time during which that header is unlikely
>>> to change
>>> # do NOT set it to 0s or less (
>>> https://info.varnish-software.com/blog/hit-for-miss-and-why-a-null-ttl-is-bad-for-you
>>> )
>>> set beresp.ttl = 2m;
>>> set beresp.uncacheable = true;
>>> return (deliver);
>>> }
>>> }
>>>
>>> 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.
>>>
>>> Would that work for you?
>>>
>>> --
>>> Guillaume Quintard
>>>
>>>
>>> On Tue, May 28, 2024 at 4:55 AM Uday Kumar 
>>> wrote:
>>>
 Hello all,

 We need to prevent caching in Varnish based on a specific header from
 the backend.

 Could you please suggest the best approach to achieve this?


 *Thanks & Regards,*
 *Uday Kumar*
 ___
 varnish-misc mailing list
 varnish-misc@varnish-cache.org
 https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

>>>
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Re: Preventing Caching in Varnish Based on Backend Response Header

2024-06-11 Thread Uday Kumar
Hello Guillaume,
We have made required changes at our end, but we have doubt on giving
suitable TTL for uncacheable objects

if (beresp.http.Cache-Control ~ "no-cache") {
set beresp.ttl = *doubt*;
set beresp.uncacheable = true;
}

FYI;
we have ttl of 24hrs for normal objects which are cacheable

May I know if there is any way to find the best possible TTL?

*Thanks & Regards,*
*Uday Kumar*


On Tue, May 28, 2024 at 7:07 PM Uday Kumar  wrote:

> Hello Guillaume,
> Great to know about this, it should work for us!
> will check this out
>
> *Thanks & Regards,*
> *Uday Kumar*
>
>
> On Tue, May 28, 2024 at 5:53 PM Guillaume Quintard <
> guillaume.quint...@gmail.com> wrote:
>
>> Hi Uday,
>>
>> Sure, the classic practice will do nicely:
>>
>> sub vcl_backend_response {
>> if (beresp.http.that-specific-header) {
>> # TTL should match the time during which that header is unlikely
>> to change
>> # do NOT set it to 0s or less (
>> https://info.varnish-software.com/blog/hit-for-miss-and-why-a-null-ttl-is-bad-for-you
>> )
>> set beresp.ttl = 2m;
>> set beresp.uncacheable = true;
>> return (deliver);
>> }
>> }
>>
>> 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.
>>
>> Would that work for you?
>>
>> --
>> Guillaume Quintard
>>
>>
>> On Tue, May 28, 2024 at 4:55 AM Uday Kumar 
>> wrote:
>>
>>> Hello all,
>>>
>>> We need to prevent caching in Varnish based on a specific header from
>>> the backend.
>>>
>>> Could you please suggest the best approach to achieve this?
>>>
>>>
>>> *Thanks & Regards,*
>>> *Uday Kumar*
>>> ___
>>> varnish-misc mailing list
>>> varnish-misc@varnish-cache.org
>>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>>
>>
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Re: Preventing Caching in Varnish Based on Backend Response Header

2024-05-28 Thread Uday Kumar
Hello Guillaume,
Great to know about this, it should work for us!
will check this out

*Thanks & Regards,*
*Uday Kumar*


On Tue, May 28, 2024 at 5:53 PM Guillaume Quintard <
guillaume.quint...@gmail.com> wrote:

> Hi Uday,
>
> Sure, the classic practice will do nicely:
>
> sub vcl_backend_response {
> if (beresp.http.that-specific-header) {
> # TTL should match the time during which that header is unlikely
> to change
> # do NOT set it to 0s or less (
> https://info.varnish-software.com/blog/hit-for-miss-and-why-a-null-ttl-is-bad-for-you
> )
> set beresp.ttl = 2m;
> set beresp.uncacheable = true;
> return (deliver);
> }
> }
>
> 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.
>
> Would that work for you?
>
> --
> Guillaume Quintard
>
>
> On Tue, May 28, 2024 at 4:55 AM Uday Kumar 
> wrote:
>
>> Hello all,
>>
>> We need to prevent caching in Varnish based on a specific header from the
>> backend.
>>
>> Could you please suggest the best approach to achieve this?
>>
>>
>> *Thanks & Regards,*
>> *Uday Kumar*
>> ___
>> varnish-misc mailing list
>> varnish-misc@varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>>
>
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Re: Preventing Caching in Varnish Based on Backend Response Header

2024-05-28 Thread Guillaume Quintard
Hi Uday,

Sure, the classic practice will do nicely:

sub vcl_backend_response {
if (beresp.http.that-specific-header) {
# TTL should match the time during which that header is unlikely to
change
# do NOT set it to 0s or less (
https://info.varnish-software.com/blog/hit-for-miss-and-why-a-null-ttl-is-bad-for-you
)
set beresp.ttl = 2m;
set beresp.uncacheable = true;
return (deliver);
}
}

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.

Would that work for you?

-- 
Guillaume Quintard


On Tue, May 28, 2024 at 4:55 AM Uday Kumar  wrote:

> Hello all,
>
> We need to prevent caching in Varnish based on a specific header from the
> backend.
>
> Could you please suggest the best approach to achieve this?
>
>
> *Thanks & Regards,*
> *Uday Kumar*
> ___
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


Preventing Caching in Varnish Based on Backend Response Header

2024-05-28 Thread Uday Kumar
Hello all,

We need to prevent caching in Varnish based on a specific header from the
backend.

Could you please suggest the best approach to achieve this?


*Thanks & Regards,*
*Uday Kumar*
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc