You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by mahakala <ma...@gmail.com> on 2009/11/23 02:36:05 UTC

How to identify whether a object is cache hit from the response header

hi, all

Does the yts have the x-cache-by header? Thanks.

Mahakala Dubias

Re: How to identify whether a object is cache hit from the response header

Posted by mahakala <ma...@gmail.com>.
On Tue, Nov 24, 2009 at 5:35 AM, Leif Hedstrom <zw...@apache.org> wrote:

>  On 11/22/2009 08:04 PM, mahakala wrote:
>
>
>
> On Mon, Nov 23, 2009 at 10:07 AM, Eric Balsa <er...@apache.org> wrote:
>
>> You should be able to look at the Via: header that TS inserts on each
>> response. Inside the [ ] there are a set of characters. You can view
>> the translation of the characters in:
>>
>> cat traffic/trunk/proxy/http2/HttpTransact.h search for ViaString_t
>>
>>
>
> There's also a README for the the response Via: header
> "encoding",./proxy/http2/README.via. However, maybe even easier to test if
> an object is in cache or not is to send a request header like this with the
> request:
>
>      Cache-Control: only-if-cached
>
>
> If the requested URL can be served out of cache, you'll get a 200 OK. If
> not, you'll get a 504 response (I think). With command line curl, something
> like
>
>     curl -s -o /dev/null -D - -H "Cache-Control: only-if-cached" http://
> ...
>
>
> Cheers,
>
> -- leif
>
>
Thanks, Leif, I am reading on it.

Mahakala

Re: How to identify whether a object is cache hit from the response header

Posted by Leif Hedstrom <zw...@apache.org>.
On 11/22/2009 08:04 PM, mahakala wrote:
>
>
> On Mon, Nov 23, 2009 at 10:07 AM, Eric Balsa <ericb@apache.org 
> <ma...@apache.org>> wrote:
>
>     You should be able to look at the Via: header that TS inserts on each
>     response. Inside the [ ] there are a set of characters. You can view
>     the translation of the characters in:
>
>     cat traffic/trunk/proxy/http2/HttpTransact.h search for ViaString_t
>


There's also a README for the the response Via: header 
"encoding",./proxy/http2/README.via. However, maybe even easier to test 
if an object is in cache or not is to send a request header like this 
with the request:

      Cache-Control: only-if-cached


If the requested URL can be served out of cache, you'll get a 200 OK. If 
not, you'll get a 504 response (I think). With command line curl, 
something like

     curl -s -o /dev/null -D - -H "Cache-Control: only-if-cached" http://...


Cheers,

-- leif


Re: How to identify whether a object is cache hit from the response header

Posted by mahakala <ma...@gmail.com>.
On Mon, Nov 23, 2009 at 10:07 AM, Eric Balsa <er...@apache.org> wrote:

> You should be able to look at the Via: header that TS inserts on each
> response. Inside the [ ] there are a set of characters. You can view
> the translation of the characters in:
>
> cat traffic/trunk/proxy/http2/HttpTransact.h search for ViaString_t
>
> --Eric
>
> On Sun, Nov 22, 2009 at 5:36 PM, mahakala <ma...@gmail.com> wrote:
> > hi, all
> >
> > Does the yts have the x-cache-by header? Thanks.
> >
> > Mahakala Dubias
> >
>

Thanks, Eric. It very useful.

Re: How to identify whether a object is cache hit from the response header

Posted by Eric Balsa <er...@apache.org>.
You should be able to look at the Via: header that TS inserts on each
response. Inside the [ ] there are a set of characters. You can view
the translation of the characters in:

cat traffic/trunk/proxy/http2/HttpTransact.h search for ViaString_t

--Eric

On Sun, Nov 22, 2009 at 5:36 PM, mahakala <ma...@gmail.com> wrote:
> hi, all
>
> Does the yts have the x-cache-by header? Thanks.
>
> Mahakala Dubias
>