Hi Benjamin, I used the source as documentation https://github.com/apache/trafficserver/blob/master/cmd/traffic_via/traffic_via.cc
Veiko 2017-12-13 19:33 GMT+02:00 Benjamin Morel <[email protected]>: > 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? > 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 <[email protected]> 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 <[email protected]>: >> >>> 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 <[email protected]>: >>> >>>> You can use the Via header: >>>> >>>> ############################################################ >>>> ################## >>>> # Via: headers. Docs: >>>> # https://docs.trafficserver.apache.org/records.config#proxy-c >>>> onfig-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 <[email protected]> >>>> wrote: >>>> >>>>> Perhaps use the X-Debug header: >>>>> https://docs.trafficserver.apache.org/en/7.1.x/admin-guide/p >>>>> lugins/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 >>>>> <[email protected]> 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 >>>>> >>>> >>>> >>>> >>> >> >
