trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Morel <benjamin.mo...@gmail.com>
Subject Re: Cache HIT/MISS header
Date Tue, 19 Dec 2017 11:16:15 GMT
> I used the source as documentation https://github.
> com/apache/trafficserver/blob/master/cmd/traffic_via/traffic_via.cc


https://docs.trafficserver.apache.org/en/7.1.x/
> appendices/faq.en.html#how-do-i-interpret-the-via-header-code


Thanks to both of you!

Ben

On 14 December 2017 at 17:35, Miles Libbey <mlibbey@apache.org> wrote:

> On Wed, Dec 13, 2017 at 9:33 AM, Benjamin Morel
> <benjamin.morel@gmail.com> wrote:
> > Thank you all for your replies. TBH I expected it to be much simpler!
> >
> > That being said, proxy.config.http.insert_request_via_str, and parsing
> the
> > resulting Via header, looks like the way to go.
> >
> > Apart from the obscure decoder, is there a documentation for the format
> of
> > the Via transaction codes?
>
> https://docs.trafficserver.apache.org/en/7.1.x/
> appendices/faq.en.html#how-do-i-interpret-the-via-header-code
>
> > With a listing of all possible statuses (cR = fresh Ram hit, cH = fresh
> hit,
> > ...)
> >
> > I couldn't find this in the doc.
> >
> > Thanks in advance,
> > Ben
> >
> > On 13 December 2017 at 10:43, Veiko Kukk <veiko.kukk@gmail.com> wrote:
> >>
> >> If you also need MISS (our setup does not, we know amount of requests
> and
> >> amount of HIT's), you need to add another condition with set-header
> X-Cache
> >> "MISS"
> >>
> >> --
> >> Veiko
> >>
> >>
> >> 2017-12-12 14:10 GMT+02:00 Veiko Kukk <veiko.kukk@gmail.com>:
> >>>
> >>> Hi,
> >>>
> >>> I recently had exact same task: to include cache status in response
> >>> headers. That's what I did:
> >>>
> >>> * proxy.config.http.insert_response_via_str 2
> >>> * Using header_rewrite plugin to create additional header with
> following
> >>> config:
> >>> cond %{SEND_RESPONSE_HDR_HOOK} [AND]
> >>> cond %{HEADER:Via} /(\[cH|\[cR)/
> >>> set-header X-Cache "HIT"
> >>>
> >>> Veiko
> >>>
> >>>
> >>> 2017-12-12 2:29 GMT+02:00 Igor Cicimov <igorc@encompasscorporation.com
> >:
> >>>>
> >>>> You can use the Via header:
> >>>>
> >>>>
> >>>> ############################################################
> ##################
> >>>> # Via: headers. Docs:
> >>>> #
> >>>> https://docs.trafficserver.apache.org/records.config#
> proxy-config-http-insert-response-via-str
> >>>>
> >>>> ############################################################
> ##################
> >>>> CONFIG proxy.config.http.insert_request_via_str INT 1
> >>>> CONFIG proxy.config.http.insert_response_via_str INT 3
> >>>> CONFIG proxy.config.http.response_via_str STRING ATS
> >>>>
> >>>> that will insert values like below that you can decode:
> >>>>
> >>>> # traffic_via  '[cHs f ]'
> >>>> Via header is [cHs f ], Length is 8
> >>>> Via Header Details:
> >>>> Result of Traffic Server cache lookup for URL          :in cache,
> fresh
> >>>> (a cache "HIT")
> >>>> Response information received from origin server       :no server
> >>>> connection needed
> >>>> Result of document write-to-cache:                     :no cache write
> >>>> performed
> >>>>
> >>>> for detailed stats (insert_response_via_str INT 3):
> >>>>
> >>>> # traffic_via 'uScHs f p eN:t cCHi p s '
> >>>> Via header is uScHs f p eN:t cCHi p s , Length is 24
> >>>> Via Header Details:
> >>>> Request headers received from client                   :simple request
> >>>> (not conditional)
> >>>> Result of Traffic Server cache lookup for URL          :in cache,
> fresh
> >>>> (a cache "HIT")
> >>>> Response information received from origin server       :no server
> >>>> connection needed
> >>>> Result of document write-to-cache:                     :no cache write
> >>>> performed
> >>>> Proxy operation result                                 :unknown
> >>>> Error codes (if any)                                   :no error
> >>>> Tunnel info                                            :no tunneling
> >>>> Cache Type                                             :cache
> >>>> Cache Lookup Result                                    :cache hit
> >>>> ICP status                                             :no icp
> >>>> Parent proxy connection status                         :no parent
> proxy
> >>>> or unknown
> >>>> Origin server connection status                        :no server
> >>>> connection needed
> >>>>
> >>>> but you might be already familiar with it and not exactly what you
> need.
> >>>>
> >>>>
> >>>> On Tue, Dec 12, 2017 at 11:11 AM, Miles Libbey <mlibbey@apache.org>
> >>>> wrote:
> >>>>>
> >>>>> Perhaps use the X-Debug header:
> >>>>>
> >>>>> https://docs.trafficserver.apache.org/en/7.1.x/admin-
> guide/plugins/xdebug.en.html
> >>>>> and maybe a global header_rewrite rule to add the magic header to
> make
> >>>>> the debug part appear?
> >>>>>
> >>>>> On Mon, Dec 11, 2017 at 8:57 AM, Benjamin Morel
> >>>>> <benjamin.morel@gmail.com> wrote:
> >>>>> > Sorry if this has been asked before, but I couldn't find it
in the
> >>>>> > docs.
> >>>>> >
> >>>>> > I'm using ATS as a forward proxy. Is there a way to add a response
> >>>>> > header to
> >>>>> > tell me if the request was a HIT or a MISS?
> >>>>> >
> >>>>> > Something like: X-Cache: HIT
> >>>>> >
> >>>>> > Thanks in advance,
> >>>>> > Benjamin
> >>>>
> >>>>
> >>>>
> >>>
> >>
> >
>

Mime
View raw message