Cache HIT/MISS header

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Cache HIT/MISS header

Benjamin Morel
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
Reply | Threaded
Open this post in threaded view
|

Re: Cache HIT/MISS header

Miles Libbey
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
<[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: Cache HIT/MISS header

Igor Cicimov
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 <[hidden email]> 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
<[hidden email]> 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


Reply | Threaded
Open this post in threaded view
|

Re: Cache HIT/MISS header

Veiko Kukk
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 <[hidden email]>:
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 <[hidden email]> 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
<[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

Re: Cache HIT/MISS header

Veiko Kukk
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 <[hidden email]>:
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 <[hidden email]>:
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 <[hidden email]> 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
<[hidden email]> 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




Reply | Threaded
Open this post in threaded view
|

Re: Cache HIT/MISS header

Benjamin Morel
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 <[hidden email]> 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 <[hidden email]>:
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 <[hidden email]>:
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 <[hidden email]> 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
<[hidden email]> 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





Reply | Threaded
Open this post in threaded view
|

Re: Cache HIT/MISS header

James Peach
In reply to this post by Benjamin Morel


> On Dec 11, 2017, at 8:57 AM, Benjamin Morel <[hidden email]> 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

I'd use the `xdebug` plugin, see <https://docs.trafficserver.apache.org/en/7.1.x/admin-guide/plugins/xdebug.en.html>. If you want the `X-Cache` header in every response, then you can use `header_rewrite` to inject the appropriate `X-Debug` header on every request.

J
Reply | Threaded
Open this post in threaded view
|

Re: Cache HIT/MISS header

Veiko Kukk
2017-12-13 21:09 GMT+02:00 James Peach <[hidden email]>:


I'd use the `xdebug` plugin, see <https://docs.trafficserver.apache.org/en/7.1.x/admin-guide/plugins/xdebug.en.html>. If you want the `X-Cache` header in every response, then you can use `header_rewrite` to inject the appropriate `X-Debug` header on every request.


Why would you rewrite headers twice and include unneccessary x-debug plugin to achieve what can be done much simpler way. This does not seem optimal way.

Veiko


Reply | Threaded
Open this post in threaded view
|

Re: Cache HIT/MISS header

Veiko Kukk
In reply to this post by Benjamin Morel

2017-12-13 19:33 GMT+02:00 Benjamin Morel <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]>:
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 <[hidden email]>:
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 <[hidden email]> 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
<[hidden email]> 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






Reply | Threaded
Open this post in threaded view
|

Re: Cache HIT/MISS header

Miles Libbey
In reply to this post by Benjamin Morel
On Wed, Dec 13, 2017 at 9:33 AM, Benjamin Morel
<[hidden email]> 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 <[hidden email]> 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 <[hidden email]>:
>>>
>>> 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 <[hidden email]>:
>>>>
>>>> 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 <[hidden email]>
>>>> 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
>>>>> <[hidden email]> 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
>>>>
>>>>
>>>>
>>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Cache HIT/MISS header

Benjamin Morel

I used the source as documentation https://github.com/apache/trafficserver/blob/master/cmd/traffic_via/traffic_via.cc


Thanks to both of you!

Ben

On 14 December 2017 at 17:35, Miles Libbey <[hidden email]> wrote:
On Wed, Dec 13, 2017 at 9:33 AM, Benjamin Morel
<[hidden email]> 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 <[hidden email]> 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 <[hidden email]>:
>>>
>>> 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 <[hidden email]>:
>>>>
>>>> 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 <[hidden email]>
>>>> 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
>>>>> <[hidden email]> 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
>>>>
>>>>
>>>>
>>>
>>
>