You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Sławomir Skowron <sl...@gmail.com> on 2012/07/08 20:25:21 UTC

method HEAD - how to never cache ??

Hi,

I am ready to switch into Traffic Server ,with production, but i stack
with caching politics, with this case, one :).

In doc there is only put, get, post, trace. I need to NOT cache, a
HEAD request, is there any way to do this in Traffic Server ??

Regards

Slawek Skowron

Re: method HEAD - how to never cache ??

Posted by Leif Hedstrom <zw...@apache.org>.
On 7/9/12 2:25 AM, Sławomir Skowron wrote:
> Hi,
>
> I am ready to switch into Traffic Server ,with production, but i stack
> with caching politics, with this case, one :).
>
> In doc there is only put, get, post, trace. I need to NOT cache, a
> HEAD request, is there any way to do this in Traffic Server ??
>

Are you sure that it is caching the response to the HEAD request? I 
would have assumed that it would not. It will serve a HEAD request out 
of an existing (fully) cached object though.

-- Leif


Re: method HEAD - how to never cache ??

Posted by Sławomir Skowron <sz...@gmail.com>.
Ok. My fault, everything works perfect. Thanks for response, and help.
Very good peace of software i'am very much impressed.

On Mon, Jul 9, 2012 at 12:04 PM, Leif Hedstrom <zw...@apache.org> wrote:
> On 7/9/12 5:37 PM, Sławomir Skowron wrote:
>>
>> Maybe i wrongly explain my problem.
>>
>> Yes it is better if i do direct HEAD into backend via Traffic Server,
>> and it is what i need :).
>> Right now i can't HEAD object if it's not in cache. I get 404, and
>> only after GET, when object is in cache, HEAD return 200. Maybe doing
>> something wrong ??
>
>
>
> Yeah, that's not expected behavior. If the object is not in cache, it should
> proxy the HEAD request to the origin, and the origin should return it. Are
> you sure it's not your origin server refusing to handle the HEAD request ?
>
> -- Leif
>



-- 
-----
Pozdrawiam

Sławek "sZiBis" Skowron

Re: method HEAD - how to never cache ??

Posted by Leif Hedstrom <zw...@apache.org>.
On 7/9/12 5:37 PM, Sławomir Skowron wrote:
> Maybe i wrongly explain my problem.
>
> Yes it is better if i do direct HEAD into backend via Traffic Server,
> and it is what i need :).
> Right now i can't HEAD object if it's not in cache. I get 404, and
> only after GET, when object is in cache, HEAD return 200. Maybe doing
> something wrong ??


Yeah, that's not expected behavior. If the object is not in cache, it 
should proxy the HEAD request to the origin, and the origin should 
return it. Are you sure it's not your origin server refusing to handle 
the HEAD request ?

-- Leif


Re: method HEAD - how to never cache ??

Posted by Sławomir Skowron <sz...@gmail.com>.
Maybe i wrongly explain my problem.

Yes it is better if i do direct HEAD into backend via Traffic Server,
and it is what i need :).
Right now i can't HEAD object if it's not in cache. I get 404, and
only after GET, when object is in cache, HEAD return 200. Maybe doing
something wrong ??

If i understood you explain my case like above.

On Mon, Jul 9, 2012 at 10:52 AM, Leif Hedstrom <zw...@apache.org> wrote:
> On 7/9/12 1:35 PM, Sławomir Skowron wrote:
>>
>> If the object is in cache it's work ok, but when i don't have object
>> in cache i wan't Get this object.
>> When object is not in cache i need full direct head operation into
>> mapped backend, and then if necessary get object into cache.
>>
>> Is this possible ??
>>
>
>
> I think it would be difficult, and potentially dangerous, for the general
> use case. For example, if you convert the HEAD request to a GET request to
> origin, how do you know that the response is going to be cacheable? If it's
> not cacheable, you have now wasted a lot of resources fetching the full
> object (with a GET) instead of the less resource intensive HEAD request.
>
> Also, we would need to convert the response from the GET to the origin to
> just a "HEAD" response. This would be doable, but I don't think we have
> anything in the code in there for that. And I suspect it's not a priority,
> because there's no general use case where you can (and should) do this sort
> of conversion?
>
> Maybe someone else of our protocol jockeys have a different opinion?
>
> -- Leif
>



-- 
-----
Pozdrawiam

Sławek "sZiBis" Skowron

Re: method HEAD - how to never cache ??

Posted by Leif Hedstrom <zw...@apache.org>.
On 7/9/12 1:35 PM, Sławomir Skowron wrote:
> If the object is in cache it's work ok, but when i don't have object
> in cache i wan't Get this object.
> When object is not in cache i need full direct head operation into
> mapped backend, and then if necessary get object into cache.
>
> Is this possible ??
>


I think it would be difficult, and potentially dangerous, for the 
general use case. For example, if you convert the HEAD request to a GET 
request to origin, how do you know that the response is going to be 
cacheable? If it's not cacheable, you have now wasted a lot of resources 
fetching the full object (with a GET) instead of the less resource 
intensive HEAD request.

Also, we would need to convert the response from the GET to the origin 
to just a "HEAD" response. This would be doable, but I don't think we 
have anything in the code in there for that. And I suspect it's not a 
priority, because there's no general use case where you can (and should) 
do this sort of conversion?

Maybe someone else of our protocol jockeys have a different opinion?

-- Leif


Re: method HEAD - how to never cache ??

Posted by Sławomir Skowron <sz...@gmail.com>.
If the object is in cache it's work ok, but when i don't have object
in cache i wan't Get this object.
When object is not in cache i need full direct head operation into
mapped backend, and then if necessary get object into cache.

Is this possible ??

Regards

iSS

Dnia 9 lip 2012 o godz. 01:01 Leif Hedstrom <zw...@apache.org> napisał(a):

> On 7/9/12 2:25 AM, Sławomir Skowron wrote:
>> Hi,
>>
>> I am ready to switch into Traffic Server ,with production, but i stack
>> with caching politics, with this case, one :).
>>
>> In doc there is only put, get, post, trace. I need to NOT cache, a
>> HEAD request, is there any way to do this in Traffic Server ??
>>
>
> Are you sure that it is caching the response to the HEAD request? I
> would have assumed that it would not. It will serve a HEAD request out
> of an existing (fully) cached object though.
>
> -- Leif
>