You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by "Divittorio, Vincenzo" <vi...@accenture.com> on 2019/02/11 12:37:29 UTC

how manage headers in cache

Hi all,
I'm using ATS as reverse proxy cache.
It works for HTTP GET request with parameter in URL.
My question is: can we add to the request key also some headers?

This is the example: I have following request
URI: http://myhost:myport/cxf/stubs/ats/username?name=Peter<http://10.1.65.73:18009/cxf/expo20/jaws/stubs/ats/username?name=Peter>
Headers:

  *   Surname: Green
  *   Timestamp: 1234567890
  *   Content-type: application/json



  *   Response:
{
    "output": "hello Peter Green"
}

Now, ATS works until when the URI is always the same. If I change in the header Surname=Black, it goes to retrieve data from cache but in this case is should be forwarded to backend because the surname is different.

What I want to do it to accept as key of request (to verify if it exists or not) also an header whitelist in order to say ok you have to retrieve from cache not just if the URI is the same but if uri + surname header value are the same.
How I can include some headers to identify if the request (as a key) is an entry of my cache?
Thanks
Regards












________________________________

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
______________________________________________________________________________________

www.accenture.com

Re: [External] Re: how manage headers in cache

Posted by Miles Libbey <ml...@apache.org>.
Yes, the cachekey plugin allows you to add request header values into the
cache key -- so, your Green and Black objects would be stored distinctly.

I'd probably go down that route, and use the Vary for compression
alternates.

On Mon, Feb 11, 2019 at 7:39 AM Divittorio, Vincenzo <
vincenzo.divittorio@accenture.com> wrote:

> Yes this is exactly what I need šŸ˜Š
>
> But if the headers are more than one, for example 10 headers, have I use
> this?
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>
>
> thanks a lot for your help
>
>
>
> *From:* David Carlin <dc...@apache.org>
> *Sent:* lunedƬ 11 febbraio 2019 16:27
> *To:* Divittorio, Vincenzo <vi...@accenture.com>
> *Cc:* users@trafficserver.apache.org
> *Subject:* Re: [External] Re: how manage headers in cache
>
>
>
> I still stand by my recommendation :)   Vary header is what you want.  If
> you add Vary to the origin response, the next request ATS will make sure
> Surname from request matches Surname on cached response prior to serving
> item from cache.  If it doesn't match, it will go to origin.
>
>
>
> Maybe this article explains Vary header better - see "How Vary works: a
> recap"
>
>
>
> https://www.fastly.com/blog/getting-most-out-vary-fastly
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.fastly.com_blog_getting-2Dmost-2Dout-2Dvary-2Dfastly&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=A-yGM7PTUB26LvK21C_UAb37PIKVe6QQa4726c_HX4U&s=vnYdfyEPgGeeswCF3LnMYDhipeoZFQSa26rPFzL_8r8&e=>
>
>
>
> David
>
>
>
> On Mon, Feb 11, 2019 at 8:08 AM Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com> wrote:
>
> Hello,
>
> I donā€™t want to add header in the response but to identiy an unique
> request I need to evaluate URI request and only one header in the request.
>
> You imagine that I have a rqeust that accept name in query param and
> surname in the header.
>
> The response will return ā€œHello Name surnameā€. It means that to understand
> if the request is unique or not, if the request is already present or not I
> need to evaluate also one header in the request.
>
>
>
> If I evaluate just the URI it is not sufficient
>
>
>
> Example
>
> Request 1 /get/username?name=Peter
>
> HEADER
>
> Surname: Green
>
>
>
> Response Hello Peter Green
>
>
>
> Request 2 /get/username?name=Peter
>
> HEADER
>
> Surname: Black
>
>
>
> Response Hello Peter Black
>
>
>
> If I will evaluate just the header I will not able if we are talking about
> Peter Green or Peter Black.
>
> So finally how I can evaluate also an header in the request?
>
>
>
> Thanks
>
>
>
>
>
> *From:* David Carlin <dc...@apache.org>
> *Sent:* lunedƬ 11 febbraio 2019 13:52
> *To:* users@trafficserver.apache.org; Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com>
> *Subject:* [External] Re: how manage headers in cache
>
>
>
> Vincenzo,
>
> What if you add "Vary:  Surname" header to the origin response?
>
> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__developer.mozilla.org_en-2DUS_docs_Web_HTTP_Headers_Vary&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=oeZEV71gGZEKIeCNau7I0lfxMDv3MCedSoVBDtsI9MY&e=>
>
>
>
> Also be aware of this ATS setting which controls the maximum number of
> alternates for an object in cache (for a given URI):
>
>
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html?highlight=empty#proxy-config-cache-limits-http-max-alts
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_files_records.config.en.html-3Fhighlight-3Dempty-23proxy-2Dconfig-2Dcache-2Dlimits-2Dhttp-2Dmax-2Dalts&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=trsxp1_pf_DhVrLtthikdhBYuVvVYabPc_CEP-t4dC4&e=>
>
>
>
> If you expect lots of alternates, I would consider the cachekey plugin so
> that you can make the request header part of the cache key:
>
>
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>
>
>
>
> David
>
>
>
>
>
>
>
> On Mon, Feb 11, 2019 at 7:43 AM Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com> wrote:
>
> Hi all,
>
> Iā€™m using ATS as reverse proxy cache.
>
> It works for HTTP GET request with parameter in URL.
>
> My question is: can we add to the request key also some headers?
>
>
>
> This is the example: I have following request
>
> *URI*: http://myhost:myport/cxf/stubs/ats/username?name=Peter
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__10.1.65.73-3A18009_cxf_expo20_jaws_stubs_ats_username-3Fname-3DPeter&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=D1a8k1j6vWitg8dAS0stN9clWe8RQw_y5pip8obMXpc&e=>
>
> *Headers*:
>
>    - Surname: Green
>    - Timestamp: 1234567890
>    - Content-type: application/json
>
>
>
>
>
>    - *Response*:
>    {
>
>     "output": "hello Peter Green"
>
> }
>
>
>
> Now, ATS works until when the URI is always the same. If I change in the
> header Surname=Black, it goes to retrieve data from cache but in this case
> is should be forwarded to backend because the surname is different.
>
>
>
> What I want to do it to accept as key of request (to verify if it exists
> or not) also an header whitelist in order to say ok you have to retrieve
> from cache not just if the URI is the same but if *uri* + *surname*
> header value are the same.
>
> How I can include some headers to identify if the request (as a key) is an
> entry of my cache?
>
> Thanks
>
> Regards
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise confidential information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the e-mail by you is prohibited. Where allowed
> by local law, electronic communications with Accenture and its affiliates,
> including e-mail and instant messaging (including content), may be scanned
> by our systems for the purposes of information security and assessment of
> internal compliance with Accenture policy. Your privacy is important to us.
> Accenture uses your personal data only in compliance with data protection
> laws. For further information on how Accenture processes your personal
> data, please see our privacy statement at
> https://www.accenture.com/us-en/privacy-policy.
>
> ______________________________________________________________________________________
>
> www.accenture.com
>
>

RE: [External] Re: how manage headers in cache

Posted by "Divittorio, Vincenzo" <vi...@accenture.com>.
Yes this is exactly what I need šŸ˜Š
But if the headers are more than one, for example 10 headers, have I use this?
https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html<https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>
thanks a lot for your help

From: David Carlin <dc...@apache.org>
Sent: lunedƬ 11 febbraio 2019 16:27
To: Divittorio, Vincenzo <vi...@accenture.com>
Cc: users@trafficserver.apache.org
Subject: Re: [External] Re: how manage headers in cache

I still stand by my recommendation :)   Vary header is what you want.  If you add Vary to the origin response, the next request ATS will make sure Surname from request matches Surname on cached response prior to serving item from cache.  If it doesn't match, it will go to origin.

Maybe this article explains Vary header better - see "How Vary works: a recap"

https://www.fastly.com/blog/getting-most-out-vary-fastly<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.fastly.com_blog_getting-2Dmost-2Dout-2Dvary-2Dfastly&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=A-yGM7PTUB26LvK21C_UAb37PIKVe6QQa4726c_HX4U&s=vnYdfyEPgGeeswCF3LnMYDhipeoZFQSa26rPFzL_8r8&e=>

David

On Mon, Feb 11, 2019 at 8:08 AM Divittorio, Vincenzo <vi...@accenture.com>> wrote:
Hello,
I donā€™t want to add header in the response but to identiy an unique request I need to evaluate URI request and only one header in the request.
You imagine that I have a rqeust that accept name in query param and surname in the header.
The response will return ā€œHello Name surnameā€. It means that to understand if the request is unique or not, if the request is already present or not I need to evaluate also one header in the request.

If I evaluate just the URI it is not sufficient

Example
Request 1 /get/username?name=Peter
HEADER
Surname: Green

Response Hello Peter Green

Request 2 /get/username?name=Peter
HEADER
Surname: Black

Response Hello Peter Black

If I will evaluate just the header I will not able if we are talking about Peter Green or Peter Black.
So finally how I can evaluate also an header in the request?

Thanks


From: David Carlin <dc...@apache.org>>
Sent: lunedƬ 11 febbraio 2019 13:52
To: users@trafficserver.apache.org<ma...@trafficserver.apache.org>; Divittorio, Vincenzo <vi...@accenture.com>>
Subject: [External] Re: how manage headers in cache

Vincenzo,

What if you add "Vary:  Surname" header to the origin response?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary<https://urldefense.proofpoint.com/v2/url?u=https-3A__developer.mozilla.org_en-2DUS_docs_Web_HTTP_Headers_Vary&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=oeZEV71gGZEKIeCNau7I0lfxMDv3MCedSoVBDtsI9MY&e=>

Also be aware of this ATS setting which controls the maximum number of alternates for an object in cache (for a given URI):

https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html?highlight=empty#proxy-config-cache-limits-http-max-alts<https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_files_records.config.en.html-3Fhighlight-3Dempty-23proxy-2Dconfig-2Dcache-2Dlimits-2Dhttp-2Dmax-2Dalts&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=trsxp1_pf_DhVrLtthikdhBYuVvVYabPc_CEP-t4dC4&e=>

If you expect lots of alternates, I would consider the cachekey plugin so that you can make the request header part of the cache key:

https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html<https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>

David



On Mon, Feb 11, 2019 at 7:43 AM Divittorio, Vincenzo <vi...@accenture.com>> wrote:
Hi all,
Iā€™m using ATS as reverse proxy cache.
It works for HTTP GET request with parameter in URL.
My question is: can we add to the request key also some headers?

This is the example: I have following request
URI: http://myhost:myport/cxf/stubs/ats/username?name=Peter<https://urldefense.proofpoint.com/v2/url?u=http-3A__10.1.65.73-3A18009_cxf_expo20_jaws_stubs_ats_username-3Fname-3DPeter&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=D1a8k1j6vWitg8dAS0stN9clWe8RQw_y5pip8obMXpc&e=>
Headers:

  *   Surname: Green
  *   Timestamp: 1234567890
  *   Content-type: application/json



  *   Response:
{
    "output": "hello Peter Green"
}

Now, ATS works until when the URI is always the same. If I change in the header Surname=Black, it goes to retrieve data from cache but in this case is should be forwarded to backend because the surname is different.

What I want to do it to accept as key of request (to verify if it exists or not) also an header whitelist in order to say ok you have to retrieve from cache not just if the URI is the same but if uri + surname header value are the same.
How I can include some headers to identify if the request (as a key) is an entry of my cache?
Thanks
Regards












________________________________

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
______________________________________________________________________________________

www.accenture.com<http://www.accenture.com>

Re: [External] Re: how manage headers in cache

Posted by Miles Libbey <ml...@apache.org>.
When you run
curl -IXGET
http://dcpp-jaws-cache.ams.accenture.com:19009/cxf/stubs/ats/serColor?name=color1+surname=Green
-H"surname:
red" -H "X-Debug: X-Cache-Key, Via"

What is the output? Do your logs show any issues loading the cachekey
plugin (eg, are you sure the remap config shown is loaded)? If you change
the  @pparam to be something like @pparam=--remove-all-params=true (and
reload) , does that change the X-Cache-Key?

On Tue, Feb 12, 2019 at 9:42 PM Divittorio, Vincenzo <
vincenzo.divittorio@accenture.com> wrote:

> Hi guys,
>
> I have used DNS acronyms just to be more fast, but at the end I have used
> the real hostname in the configuration files.
>
> Please take a look here, those are real configurations done.
>
> Any suggestion?
>
>
>
> *Remap.config*
>
>
>
> map          http://dcpp-jaws-cache.ams.accenture.com:19009/
> http://dcpp-jaws.ams.accenture.com:18009/ @plugin=cachekey.so
> @pparam=--include-headers=surname
>
> reverse_map http://dcpp-jaws.ams.accenture.com:18009/
> http://dcpp-jaws-cache.ams.accenture.com:19009/
>
>
>
>
>
> *Records.config (only changed parameters)*
>
> CONFIG proxy.config.http.server_ports STRING 19009 20009
>
> CONFIG proxy.config.http.cache.http INT 1
>
> CONFIG proxy.config.http.cache.required_headers INT 2
>
> CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
>
>
>
>
>
> *Sample request:*
>
>
>
>
>
> *Desired result:* the cache is populated and accessed using the
> combination of uri+header (surname).
>
> *Actual result*: cache is populated and accessed only using only URI
> (this is also showing in the cache explorer and in the XDebug: X-Cache-Key
> header), so when we change the value of surname header in the following
> request we still have the old result
>
>
>
>
>
>
>
> *From:* Miles Libbey <ml...@apache.org>
> *Sent:* martedƬ 12 febbraio 2019 18:26
> *To:* users@trafficserver.apache.org
> *Subject:* Re: [External] Re: how manage headers in cache
>
>
>
> I don't quite get your configs versus your GET. eg, your remap has
> DNS:19009 but your GET is using the host
> dcpp-jaws-cache.ams.accenture.com:18009 ... which wouldn't match. Perhaps
>  try,
>
> curl -IXGET
> http://DNS:19009/cxf/stubs/ats/serColor?name=color1+surname=Green
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__DNS-3A19009_cxf_stubs_ats_serColor-3Fname-3Dcolor1-2Bsurname-3DGreen&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=VdmnBEMro5gYPXT26mg3h8SRlZhbBzIABK-rqX0lAXU&s=hzd8xMkgzGuxNtZCJ3UM1M_xs4C2bxxBjqpsxC2T5aE&e=>
> -H"surname: red" -H "X-Debug: X-Cache-Key, Via"
>
> (the headers are much more interesting than the content in
> troubleshooting).
>
>
>
> I'd expect the resulting x-cache-key: header to be
>
> x-cache-key:
> /DNS/19009/surname:red/cxf/stubs/ats/serColor?name=color1+surname=Green
>
>
>
> On Tue, Feb 12, 2019 at 8:38 AM Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com> wrote:
>
> Hi guys I have tried to follow your suggestion in order to include several
> headers in a cache key but unfortunately does not work as expected
>
>
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>
>
> please could you help me?
>
>
>
> following steps performed
>
> *Remap.config*
>
>
>
> map          http://DNS:19009/
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__DNS-3A19009_&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=VdmnBEMro5gYPXT26mg3h8SRlZhbBzIABK-rqX0lAXU&s=ITwWBTFEG3P_seLJc0SMWG7LJET3_EI9-40BHg6Y2lY&e=>
> http:// DNS:18009/ <http://dcpp-jaws.ams.accenture.com:18009/>
> @plugin=cachekey.so @pparam=--include-headers=*surname*
>
> reverse_map http:// DNS:18009/ <http://dcpp-jaws.ams.accenture.com:18009/>
> http:// DNS:19009/ <http://dcpp-jaws-cache.ams.accenture.com:19009/>
>
>
>
>
>
> *Records.config (only changed parameters)*
>
> CONFIG proxy.config.http.server_ports STRING 19009 20009
>
> CONFIG proxy.config.http.cache.http INT 1
>
> CONFIG proxy.config.http.cache.required_headers INT 2
>
> CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
>
>
>
>
>
> *Sample request:*
>
>
>
>
>
> *Desired result:* the cache is populated and accessed using the
> combination of uri+header (surname).
>
> *Actual result*: cache is populated and accessed only using only URI
> (this is also showing in the cache explorer and in the XDebug: X-Cache-Key
> header), so when we change the value of surname header in the following
> request we still have the old result
>
>
>
> In the regex lookup my expectation was to find in the key something like
> this,
>
>
> http://dcpp-jaws-cache.ams.accenture.com:18009/cxf/stubs/ats/serColor?name=color1+surname=Green
>
>
>
> (supposing to have surname as header)
>
> Instead I see following
>
>
>
>
>
>
>
> *From:* David Carlin <dc...@apache.org>
> *Sent:* lunedƬ 11 febbraio 2019 16:27
> *To:* Divittorio, Vincenzo <vi...@accenture.com>
> *Cc:* users@trafficserver.apache.org
> *Subject:* Re: [External] Re: how manage headers in cache
>
>
>
> I still stand by my recommendation :)   Vary header is what you want.  If
> you add Vary to the origin response, the next request ATS will make sure
> Surname from request matches Surname on cached response prior to serving
> item from cache.  If it doesn't match, it will go to origin.
>
>
>
> Maybe this article explains Vary header better - see "How Vary works: a
> recap"
>
>
>
> https://www.fastly.com/blog/getting-most-out-vary-fastly
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.fastly.com_blog_getting-2Dmost-2Dout-2Dvary-2Dfastly&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=A-yGM7PTUB26LvK21C_UAb37PIKVe6QQa4726c_HX4U&s=vnYdfyEPgGeeswCF3LnMYDhipeoZFQSa26rPFzL_8r8&e=>
>
>
>
> David
>
>
>
> On Mon, Feb 11, 2019 at 8:08 AM Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com> wrote:
>
> Hello,
>
> I donā€™t want to add header in the response but to identiy an unique
> request I need to evaluate URI request and only one header in the request.
>
> You imagine that I have a rqeust that accept name in query param and
> surname in the header.
>
> The response will return ā€œHello Name surnameā€. It means that to understand
> if the request is unique or not, if the request is already present or not I
> need to evaluate also one header in the request.
>
>
>
> If I evaluate just the URI it is not sufficient
>
>
>
> Example
>
> Request 1 /get/username?name=Peter
>
> HEADER
>
> Surname: Green
>
>
>
> Response Hello Peter Green
>
>
>
> Request 2 /get/username?name=Peter
>
> HEADER
>
> Surname: Black
>
>
>
> Response Hello Peter Black
>
>
>
> If I will evaluate just the header I will not able if we are talking about
> Peter Green or Peter Black.
>
> So finally how I can evaluate also an header in the request?
>
>
>
> Thanks
>
>
>
>
>
> *From:* David Carlin <dc...@apache.org>
> *Sent:* lunedƬ 11 febbraio 2019 13:52
> *To:* users@trafficserver.apache.org; Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com>
> *Subject:* [External] Re: how manage headers in cache
>
>
>
> Vincenzo,
>
> What if you add "Vary:  Surname" header to the origin response?
>
> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__developer.mozilla.org_en-2DUS_docs_Web_HTTP_Headers_Vary&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=oeZEV71gGZEKIeCNau7I0lfxMDv3MCedSoVBDtsI9MY&e=>
>
>
>
> Also be aware of this ATS setting which controls the maximum number of
> alternates for an object in cache (for a given URI):
>
>
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html?highlight=empty#proxy-config-cache-limits-http-max-alts
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_files_records.config.en.html-3Fhighlight-3Dempty-23proxy-2Dconfig-2Dcache-2Dlimits-2Dhttp-2Dmax-2Dalts&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=trsxp1_pf_DhVrLtthikdhBYuVvVYabPc_CEP-t4dC4&e=>
>
>
>
> If you expect lots of alternates, I would consider the cachekey plugin so
> that you can make the request header part of the cache key:
>
>
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>
>
>
>
> David
>
>
>
>
>
>
>
> On Mon, Feb 11, 2019 at 7:43 AM Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com> wrote:
>
> Hi all,
>
> Iā€™m using ATS as reverse proxy cache.
>
> It works for HTTP GET request with parameter in URL.
>
> My question is: can we add to the request key also some headers?
>
>
>
> This is the example: I have following request
>
> *URI*: http://myhost:myport/cxf/stubs/ats/username?name=Peter
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__10.1.65.73-3A18009_cxf_expo20_jaws_stubs_ats_username-3Fname-3DPeter&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=D1a8k1j6vWitg8dAS0stN9clWe8RQw_y5pip8obMXpc&e=>
>
> *Headers*:
>
>    - Surname: Green
>    - Timestamp: 1234567890
>    - Content-type: application/json
>
>
>
>
>
>    - *Response*:
>    {
>
>     "output": "hello Peter Green"
>
> }
>
>
>
> Now, ATS works until when the URI is always the same. If I change in the
> header Surname=Black, it goes to retrieve data from cache but in this case
> is should be forwarded to backend because the surname is different.
>
>
>
> What I want to do it to accept as key of request (to verify if it exists
> or not) also an header whitelist in order to say ok you have to retrieve
> from cache not just if the URI is the same but if *uri* + *surname*
> header value are the same.
>
> How I can include some headers to identify if the request (as a key) is an
> entry of my cache?
>
> Thanks
>
> Regards
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise confidential information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the e-mail by you is prohibited. Where allowed
> by local law, electronic communications with Accenture and its affiliates,
> including e-mail and instant messaging (including content), may be scanned
> by our systems for the purposes of information security and assessment of
> internal compliance with Accenture policy. Your privacy is important to us.
> Accenture uses your personal data only in compliance with data protection
> laws. For further information on how Accenture processes your personal
> data, please see our privacy statement at
> https://www.accenture.com/us-en/privacy-policy.
>
> ______________________________________________________________________________________
>
> www.accenture.com
>
>

RE: [External] Re: how manage headers in cache

Posted by "Divittorio, Vincenzo" <vi...@accenture.com>.
Hi guys,
I have used DNS acronyms just to be more fast, but at the end I have used the real hostname in the configuration files.
Please take a look here, those are real configurations done.
Any suggestion?

Remap.config

map          http://dcpp-jaws-cache.ams.accenture.com:19009/ http://dcpp-jaws.ams.accenture.com:18009/ @plugin=cachekey.so @pparam=--include-headers=surname
reverse_map http://dcpp-jaws.ams.accenture.com:18009/ http://dcpp-jaws-cache.ams.accenture.com:19009/


Records.config (only changed parameters)
CONFIG proxy.config.http.server_ports STRING 19009 20009
CONFIG proxy.config.http.cache.http INT 1
CONFIG proxy.config.http.cache.required_headers INT 2
CONFIG proxy.config.url_remap.pristine_host_hdr INT 1


Sample request:

[cid:image001.jpg@01D4C367.35AA2D60]

Desired result: the cache is populated and accessed using the combination of uri+header (surname).
Actual result: cache is populated and accessed only using only URI (this is also showing in the cache explorer and in the XDebug: X-Cache-Key header), so when we change the value of surname header in the following request we still have the old result

[cid:image002.jpg@01D4C367.35AA2D60]


From: Miles Libbey <ml...@apache.org>
Sent: martedƬ 12 febbraio 2019 18:26
To: users@trafficserver.apache.org
Subject: Re: [External] Re: how manage headers in cache

I don't quite get your configs versus your GET. eg, your remap has DNS:19009 but your GET is using the host
dcpp-jaws-cache.ams.accenture.com:18009<http://dcpp-jaws-cache.ams.accenture.com:18009> ... which wouldn't match. Perhaps try,
curl -IXGET http://DNS:19009/cxf/stubs/ats/serColor?name=color1+surname=Green<https://urldefense.proofpoint.com/v2/url?u=http-3A__DNS-3A19009_cxf_stubs_ats_serColor-3Fname-3Dcolor1-2Bsurname-3DGreen&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=VdmnBEMro5gYPXT26mg3h8SRlZhbBzIABK-rqX0lAXU&s=hzd8xMkgzGuxNtZCJ3UM1M_xs4C2bxxBjqpsxC2T5aE&e=> -H"surname: red" -H "X-Debug: X-Cache-Key, Via"
(the headers are much more interesting than the content in troubleshooting).

I'd expect the resulting x-cache-key: header to be
x-cache-key: /DNS/19009/surname:red/cxf/stubs/ats/serColor?name=color1+surname=Green

On Tue, Feb 12, 2019 at 8:38 AM Divittorio, Vincenzo <vi...@accenture.com>> wrote:
Hi guys I have tried to follow your suggestion in order to include several headers in a cache key but unfortunately does not work as expected

https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html<https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>
please could you help me?

following steps performed
Remap.config

map          http://DNS:19009/<https://urldefense.proofpoint.com/v2/url?u=http-3A__DNS-3A19009_&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=VdmnBEMro5gYPXT26mg3h8SRlZhbBzIABK-rqX0lAXU&s=ITwWBTFEG3P_seLJc0SMWG7LJET3_EI9-40BHg6Y2lY&e=> http:// DNS:18009/<http://dcpp-jaws.ams.accenture.com:18009/> @plugin=cachekey.so @pparam=--include-headers=surname
reverse_map http:// DNS:18009/<http://dcpp-jaws.ams.accenture.com:18009/> http:// DNS:19009/<http://dcpp-jaws-cache.ams.accenture.com:19009/>


Records.config (only changed parameters)
CONFIG proxy.config.http.server_ports STRING 19009 20009
CONFIG proxy.config.http.cache.http INT 1
CONFIG proxy.config.http.cache.required_headers INT 2
CONFIG proxy.config.url_remap.pristine_host_hdr INT 1


Sample request:

[cid:image003.jpg@01D4C367.35AA2D60]

Desired result: the cache is populated and accessed using the combination of uri+header (surname).
Actual result: cache is populated and accessed only using only URI (this is also showing in the cache explorer and in the XDebug: X-Cache-Key header), so when we change the value of surname header in the following request we still have the old result

In the regex lookup my expectation was to find in the key something like this,
http://dcpp-jaws-cache.ams.accenture.com:18009/cxf/stubs/ats/serColor?name=color1+surname=Green

(supposing to have surname as header)
Instead I see following

[cid:image004.jpg@01D4C367.35AA2D60]


From: David Carlin <dc...@apache.org>>
Sent: lunedƬ 11 febbraio 2019 16:27
To: Divittorio, Vincenzo <vi...@accenture.com>>
Cc: users@trafficserver.apache.org<ma...@trafficserver.apache.org>
Subject: Re: [External] Re: how manage headers in cache

I still stand by my recommendation :)   Vary header is what you want.  If you add Vary to the origin response, the next request ATS will make sure Surname from request matches Surname on cached response prior to serving item from cache.  If it doesn't match, it will go to origin.

Maybe this article explains Vary header better - see "How Vary works: a recap"

https://www.fastly.com/blog/getting-most-out-vary-fastly<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.fastly.com_blog_getting-2Dmost-2Dout-2Dvary-2Dfastly&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=A-yGM7PTUB26LvK21C_UAb37PIKVe6QQa4726c_HX4U&s=vnYdfyEPgGeeswCF3LnMYDhipeoZFQSa26rPFzL_8r8&e=>

David

On Mon, Feb 11, 2019 at 8:08 AM Divittorio, Vincenzo <vi...@accenture.com>> wrote:
Hello,
I donā€™t want to add header in the response but to identiy an unique request I need to evaluate URI request and only one header in the request.
You imagine that I have a rqeust that accept name in query param and surname in the header.
The response will return ā€œHello Name surnameā€. It means that to understand if the request is unique or not, if the request is already present or not I need to evaluate also one header in the request.

If I evaluate just the URI it is not sufficient

Example
Request 1 /get/username?name=Peter
HEADER
Surname: Green

Response Hello Peter Green

Request 2 /get/username?name=Peter
HEADER
Surname: Black

Response Hello Peter Black

If I will evaluate just the header I will not able if we are talking about Peter Green or Peter Black.
So finally how I can evaluate also an header in the request?

Thanks


From: David Carlin <dc...@apache.org>>
Sent: lunedƬ 11 febbraio 2019 13:52
To: users@trafficserver.apache.org<ma...@trafficserver.apache.org>; Divittorio, Vincenzo <vi...@accenture.com>>
Subject: [External] Re: how manage headers in cache

Vincenzo,

What if you add "Vary:  Surname" header to the origin response?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary<https://urldefense.proofpoint.com/v2/url?u=https-3A__developer.mozilla.org_en-2DUS_docs_Web_HTTP_Headers_Vary&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=oeZEV71gGZEKIeCNau7I0lfxMDv3MCedSoVBDtsI9MY&e=>

Also be aware of this ATS setting which controls the maximum number of alternates for an object in cache (for a given URI):

https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html?highlight=empty#proxy-config-cache-limits-http-max-alts<https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_files_records.config.en.html-3Fhighlight-3Dempty-23proxy-2Dconfig-2Dcache-2Dlimits-2Dhttp-2Dmax-2Dalts&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=trsxp1_pf_DhVrLtthikdhBYuVvVYabPc_CEP-t4dC4&e=>

If you expect lots of alternates, I would consider the cachekey plugin so that you can make the request header part of the cache key:

https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html<https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>

David



On Mon, Feb 11, 2019 at 7:43 AM Divittorio, Vincenzo <vi...@accenture.com>> wrote:
Hi all,
Iā€™m using ATS as reverse proxy cache.
It works for HTTP GET request with parameter in URL.
My question is: can we add to the request key also some headers?

This is the example: I have following request
URI: http://myhost:myport/cxf/stubs/ats/username?name=Peter<https://urldefense.proofpoint.com/v2/url?u=http-3A__10.1.65.73-3A18009_cxf_expo20_jaws_stubs_ats_username-3Fname-3DPeter&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=D1a8k1j6vWitg8dAS0stN9clWe8RQw_y5pip8obMXpc&e=>
Headers:

  *   Surname: Green
  *   Timestamp: 1234567890
  *   Content-type: application/json



  *   Response:
{
    "output": "hello Peter Green"
}

Now, ATS works until when the URI is always the same. If I change in the header Surname=Black, it goes to retrieve data from cache but in this case is should be forwarded to backend because the surname is different.

What I want to do it to accept as key of request (to verify if it exists or not) also an header whitelist in order to say ok you have to retrieve from cache not just if the URI is the same but if uri + surname header value are the same.
How I can include some headers to identify if the request (as a key) is an entry of my cache?
Thanks
Regards












________________________________

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
______________________________________________________________________________________

www.accenture.com<http://www.accenture.com>

Re: [External] Re: how manage headers in cache

Posted by Miles Libbey <ml...@apache.org>.
I don't quite get your configs versus your GET. eg, your remap has
DNS:19009 but your GET is using the host
dcpp-jaws-cache.ams.accenture.com:18009 ... which wouldn't match. Perhaps
 try,
curl -IXGET
http://DNS:19009/cxf/stubs/ats/serColor?name=color1+surname=Green
-H"surname: red" -H "X-Debug: X-Cache-Key, Via"
(the headers are much more interesting than the content in troubleshooting).

I'd expect the resulting x-cache-key: header to be
x-cache-key:
/DNS/19009/surname:red/cxf/stubs/ats/serColor?name=color1+surname=Green

On Tue, Feb 12, 2019 at 8:38 AM Divittorio, Vincenzo <
vincenzo.divittorio@accenture.com> wrote:

> Hi guys I have tried to follow your suggestion in order to include several
> headers in a cache key but unfortunately does not work as expected
>
>
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>
>
> please could you help me?
>
>
>
> following steps performed
>
> *Remap.config*
>
>
>
> map          http://DNS:19009/ http:// DNS:18009/
> <http://dcpp-jaws.ams.accenture.com:18009/> @plugin=cachekey.so
> @pparam=--include-headers=*surname*
>
> reverse_map http:// DNS:18009/ <http://dcpp-jaws.ams.accenture.com:18009/>
> http:// DNS:19009/ <http://dcpp-jaws-cache.ams.accenture.com:19009/>
>
>
>
>
>
> *Records.config (only changed parameters)*
>
> CONFIG proxy.config.http.server_ports STRING 19009 20009
>
> CONFIG proxy.config.http.cache.http INT 1
>
> CONFIG proxy.config.http.cache.required_headers INT 2
>
> CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
>
>
>
>
>
> *Sample request:*
>
>
>
>
>
> *Desired result:* the cache is populated and accessed using the
> combination of uri+header (surname).
>
> *Actual result*: cache is populated and accessed only using only URI
> (this is also showing in the cache explorer and in the XDebug: X-Cache-Key
> header), so when we change the value of surname header in the following
> request we still have the old result
>
>
>
> In the regex lookup my expectation was to find in the key something like
> this,
>
>
> http://dcpp-jaws-cache.ams.accenture.com:18009/cxf/stubs/ats/serColor?name=color1+surname=Green
>
>
>
> (supposing to have surname as header)
>
> Instead I see following
>
>
>
>
>
>
>
> *From:* David Carlin <dc...@apache.org>
> *Sent:* lunedƬ 11 febbraio 2019 16:27
> *To:* Divittorio, Vincenzo <vi...@accenture.com>
> *Cc:* users@trafficserver.apache.org
> *Subject:* Re: [External] Re: how manage headers in cache
>
>
>
> I still stand by my recommendation :)   Vary header is what you want.  If
> you add Vary to the origin response, the next request ATS will make sure
> Surname from request matches Surname on cached response prior to serving
> item from cache.  If it doesn't match, it will go to origin.
>
>
>
> Maybe this article explains Vary header better - see "How Vary works: a
> recap"
>
>
>
> https://www.fastly.com/blog/getting-most-out-vary-fastly
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.fastly.com_blog_getting-2Dmost-2Dout-2Dvary-2Dfastly&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=A-yGM7PTUB26LvK21C_UAb37PIKVe6QQa4726c_HX4U&s=vnYdfyEPgGeeswCF3LnMYDhipeoZFQSa26rPFzL_8r8&e=>
>
>
>
> David
>
>
>
> On Mon, Feb 11, 2019 at 8:08 AM Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com> wrote:
>
> Hello,
>
> I donā€™t want to add header in the response but to identiy an unique
> request I need to evaluate URI request and only one header in the request.
>
> You imagine that I have a rqeust that accept name in query param and
> surname in the header.
>
> The response will return ā€œHello Name surnameā€. It means that to understand
> if the request is unique or not, if the request is already present or not I
> need to evaluate also one header in the request.
>
>
>
> If I evaluate just the URI it is not sufficient
>
>
>
> Example
>
> Request 1 /get/username?name=Peter
>
> HEADER
>
> Surname: Green
>
>
>
> Response Hello Peter Green
>
>
>
> Request 2 /get/username?name=Peter
>
> HEADER
>
> Surname: Black
>
>
>
> Response Hello Peter Black
>
>
>
> If I will evaluate just the header I will not able if we are talking about
> Peter Green or Peter Black.
>
> So finally how I can evaluate also an header in the request?
>
>
>
> Thanks
>
>
>
>
>
> *From:* David Carlin <dc...@apache.org>
> *Sent:* lunedƬ 11 febbraio 2019 13:52
> *To:* users@trafficserver.apache.org; Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com>
> *Subject:* [External] Re: how manage headers in cache
>
>
>
> Vincenzo,
>
> What if you add "Vary:  Surname" header to the origin response?
>
> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__developer.mozilla.org_en-2DUS_docs_Web_HTTP_Headers_Vary&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=oeZEV71gGZEKIeCNau7I0lfxMDv3MCedSoVBDtsI9MY&e=>
>
>
>
> Also be aware of this ATS setting which controls the maximum number of
> alternates for an object in cache (for a given URI):
>
>
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html?highlight=empty#proxy-config-cache-limits-http-max-alts
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_files_records.config.en.html-3Fhighlight-3Dempty-23proxy-2Dconfig-2Dcache-2Dlimits-2Dhttp-2Dmax-2Dalts&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=trsxp1_pf_DhVrLtthikdhBYuVvVYabPc_CEP-t4dC4&e=>
>
>
>
> If you expect lots of alternates, I would consider the cachekey plugin so
> that you can make the request header part of the cache key:
>
>
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>
>
>
>
> David
>
>
>
>
>
>
>
> On Mon, Feb 11, 2019 at 7:43 AM Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com> wrote:
>
> Hi all,
>
> Iā€™m using ATS as reverse proxy cache.
>
> It works for HTTP GET request with parameter in URL.
>
> My question is: can we add to the request key also some headers?
>
>
>
> This is the example: I have following request
>
> *URI*: http://myhost:myport/cxf/stubs/ats/username?name=Peter
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__10.1.65.73-3A18009_cxf_expo20_jaws_stubs_ats_username-3Fname-3DPeter&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=D1a8k1j6vWitg8dAS0stN9clWe8RQw_y5pip8obMXpc&e=>
>
> *Headers*:
>
>    - Surname: Green
>    - Timestamp: 1234567890
>    - Content-type: application/json
>
>
>
>
>
>    - *Response*:
>    {
>
>     "output": "hello Peter Green"
>
> }
>
>
>
> Now, ATS works until when the URI is always the same. If I change in the
> header Surname=Black, it goes to retrieve data from cache but in this case
> is should be forwarded to backend because the surname is different.
>
>
>
> What I want to do it to accept as key of request (to verify if it exists
> or not) also an header whitelist in order to say ok you have to retrieve
> from cache not just if the URI is the same but if *uri* + *surname*
> header value are the same.
>
> How I can include some headers to identify if the request (as a key) is an
> entry of my cache?
>
> Thanks
>
> Regards
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise confidential information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the e-mail by you is prohibited. Where allowed
> by local law, electronic communications with Accenture and its affiliates,
> including e-mail and instant messaging (including content), may be scanned
> by our systems for the purposes of information security and assessment of
> internal compliance with Accenture policy. Your privacy is important to us.
> Accenture uses your personal data only in compliance with data protection
> laws. For further information on how Accenture processes your personal
> data, please see our privacy statement at
> https://www.accenture.com/us-en/privacy-policy.
>
> ______________________________________________________________________________________
>
> www.accenture.com
>
>

RE: [External] Re: how manage headers in cache

Posted by "Divittorio, Vincenzo" <vi...@accenture.com>.
Hi guys I have tried to follow your suggestion in order to include several headers in a cache key but unfortunately does not work as expected

https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html<https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>
please could you help me?

following steps performed
Remap.config

map          http://DNS:19009/ http:// DNS:18009/<http://dcpp-jaws.ams.accenture.com:18009/> @plugin=cachekey.so @pparam=--include-headers=surname
reverse_map http:// DNS:18009/<http://dcpp-jaws.ams.accenture.com:18009/> http:// DNS:19009/<http://dcpp-jaws-cache.ams.accenture.com:19009/>


Records.config (only changed parameters)
CONFIG proxy.config.http.server_ports STRING 19009 20009
CONFIG proxy.config.http.cache.http INT 1
CONFIG proxy.config.http.cache.required_headers INT 2
CONFIG proxy.config.url_remap.pristine_host_hdr INT 1


Sample request:

[cid:image001.jpg@01D4C2F9.B4CEE450]

Desired result: the cache is populated and accessed using the combination of uri+header (surname).
Actual result: cache is populated and accessed only using only URI (this is also showing in the cache explorer and in the XDebug: X-Cache-Key header), so when we change the value of surname header in the following request we still have the old result

In the regex lookup my expectation was to find in the key something like this,
http://dcpp-jaws-cache.ams.accenture.com:18009/cxf/stubs/ats/serColor?name=color1+surname=Green

(supposing to have surname as header)
Instead I see following

[cid:image002.jpg@01D4C2F9.B4CEE450]


From: David Carlin <dc...@apache.org>
Sent: lunedƬ 11 febbraio 2019 16:27
To: Divittorio, Vincenzo <vi...@accenture.com>
Cc: users@trafficserver.apache.org
Subject: Re: [External] Re: how manage headers in cache

I still stand by my recommendation :)   Vary header is what you want.  If you add Vary to the origin response, the next request ATS will make sure Surname from request matches Surname on cached response prior to serving item from cache.  If it doesn't match, it will go to origin.

Maybe this article explains Vary header better - see "How Vary works: a recap"

https://www.fastly.com/blog/getting-most-out-vary-fastly<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.fastly.com_blog_getting-2Dmost-2Dout-2Dvary-2Dfastly&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=A-yGM7PTUB26LvK21C_UAb37PIKVe6QQa4726c_HX4U&s=vnYdfyEPgGeeswCF3LnMYDhipeoZFQSa26rPFzL_8r8&e=>

David

On Mon, Feb 11, 2019 at 8:08 AM Divittorio, Vincenzo <vi...@accenture.com>> wrote:
Hello,
I donā€™t want to add header in the response but to identiy an unique request I need to evaluate URI request and only one header in the request.
You imagine that I have a rqeust that accept name in query param and surname in the header.
The response will return ā€œHello Name surnameā€. It means that to understand if the request is unique or not, if the request is already present or not I need to evaluate also one header in the request.

If I evaluate just the URI it is not sufficient

Example
Request 1 /get/username?name=Peter
HEADER
Surname: Green

Response Hello Peter Green

Request 2 /get/username?name=Peter
HEADER
Surname: Black

Response Hello Peter Black

If I will evaluate just the header I will not able if we are talking about Peter Green or Peter Black.
So finally how I can evaluate also an header in the request?

Thanks


From: David Carlin <dc...@apache.org>>
Sent: lunedƬ 11 febbraio 2019 13:52
To: users@trafficserver.apache.org<ma...@trafficserver.apache.org>; Divittorio, Vincenzo <vi...@accenture.com>>
Subject: [External] Re: how manage headers in cache

Vincenzo,

What if you add "Vary:  Surname" header to the origin response?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary<https://urldefense.proofpoint.com/v2/url?u=https-3A__developer.mozilla.org_en-2DUS_docs_Web_HTTP_Headers_Vary&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=oeZEV71gGZEKIeCNau7I0lfxMDv3MCedSoVBDtsI9MY&e=>

Also be aware of this ATS setting which controls the maximum number of alternates for an object in cache (for a given URI):

https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html?highlight=empty#proxy-config-cache-limits-http-max-alts<https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_files_records.config.en.html-3Fhighlight-3Dempty-23proxy-2Dconfig-2Dcache-2Dlimits-2Dhttp-2Dmax-2Dalts&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=trsxp1_pf_DhVrLtthikdhBYuVvVYabPc_CEP-t4dC4&e=>

If you expect lots of alternates, I would consider the cachekey plugin so that you can make the request header part of the cache key:

https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html<https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>

David



On Mon, Feb 11, 2019 at 7:43 AM Divittorio, Vincenzo <vi...@accenture.com>> wrote:
Hi all,
Iā€™m using ATS as reverse proxy cache.
It works for HTTP GET request with parameter in URL.
My question is: can we add to the request key also some headers?

This is the example: I have following request
URI: http://myhost:myport/cxf/stubs/ats/username?name=Peter<https://urldefense.proofpoint.com/v2/url?u=http-3A__10.1.65.73-3A18009_cxf_expo20_jaws_stubs_ats_username-3Fname-3DPeter&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=D1a8k1j6vWitg8dAS0stN9clWe8RQw_y5pip8obMXpc&e=>
Headers:

  *   Surname: Green
  *   Timestamp: 1234567890
  *   Content-type: application/json



  *   Response:
{
    "output": "hello Peter Green"
}

Now, ATS works until when the URI is always the same. If I change in the header Surname=Black, it goes to retrieve data from cache but in this case is should be forwarded to backend because the surname is different.

What I want to do it to accept as key of request (to verify if it exists or not) also an header whitelist in order to say ok you have to retrieve from cache not just if the URI is the same but if uri + surname header value are the same.
How I can include some headers to identify if the request (as a key) is an entry of my cache?
Thanks
Regards












________________________________

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
______________________________________________________________________________________

www.accenture.com<http://www.accenture.com>

Re: [External] Re: how manage headers in cache

Posted by David Carlin <dc...@apache.org>.
I still stand by my recommendation :)   Vary header is what you want.  If
you add Vary to the origin response, the next request ATS will make sure
Surname from request matches Surname on cached response prior to serving
item from cache.  If it doesn't match, it will go to origin.

Maybe this article explains Vary header better - see "How Vary works: a
recap"

https://www.fastly.com/blog/getting-most-out-vary-fastly

David

On Mon, Feb 11, 2019 at 8:08 AM Divittorio, Vincenzo <
vincenzo.divittorio@accenture.com> wrote:

> Hello,
>
> I donā€™t want to add header in the response but to identiy an unique
> request I need to evaluate URI request and only one header in the request.
>
> You imagine that I have a rqeust that accept name in query param and
> surname in the header.
>
> The response will return ā€œHello Name surnameā€. It means that to understand
> if the request is unique or not, if the request is already present or not I
> need to evaluate also one header in the request.
>
>
>
> If I evaluate just the URI it is not sufficient
>
>
>
> Example
>
> Request 1 /get/username?name=Peter
>
> HEADER
>
> Surname: Green
>
>
>
> Response Hello Peter Green
>
>
>
> Request 2 /get/username?name=Peter
>
> HEADER
>
> Surname: Black
>
>
>
> Response Hello Peter Black
>
>
>
> If I will evaluate just the header I will not able if we are talking about
> Peter Green or Peter Black.
>
> So finally how I can evaluate also an header in the request?
>
>
>
> Thanks
>
>
>
>
>
> *From:* David Carlin <dc...@apache.org>
> *Sent:* lunedƬ 11 febbraio 2019 13:52
> *To:* users@trafficserver.apache.org; Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com>
> *Subject:* [External] Re: how manage headers in cache
>
>
>
> Vincenzo,
>
> What if you add "Vary:  Surname" header to the origin response?
>
> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__developer.mozilla.org_en-2DUS_docs_Web_HTTP_Headers_Vary&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=oeZEV71gGZEKIeCNau7I0lfxMDv3MCedSoVBDtsI9MY&e=>
>
>
>
> Also be aware of this ATS setting which controls the maximum number of
> alternates for an object in cache (for a given URI):
>
>
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html?highlight=empty#proxy-config-cache-limits-http-max-alts
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_files_records.config.en.html-3Fhighlight-3Dempty-23proxy-2Dconfig-2Dcache-2Dlimits-2Dhttp-2Dmax-2Dalts&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=trsxp1_pf_DhVrLtthikdhBYuVvVYabPc_CEP-t4dC4&e=>
>
>
>
> If you expect lots of alternates, I would consider the cachekey plugin so
> that you can make the request header part of the cache key:
>
>
>
>
> https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>
>
>
>
> David
>
>
>
>
>
>
>
> On Mon, Feb 11, 2019 at 7:43 AM Divittorio, Vincenzo <
> vincenzo.divittorio@accenture.com> wrote:
>
> Hi all,
>
> Iā€™m using ATS as reverse proxy cache.
>
> It works for HTTP GET request with parameter in URL.
>
> My question is: can we add to the request key also some headers?
>
>
>
> This is the example: I have following request
>
> *URI*: http://myhost:myport/cxf/stubs/ats/username?name=Peter
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__10.1.65.73-3A18009_cxf_expo20_jaws_stubs_ats_username-3Fname-3DPeter&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=D1a8k1j6vWitg8dAS0stN9clWe8RQw_y5pip8obMXpc&e=>
>
> *Headers*:
>
>    - Surname: Green
>    - Timestamp: 1234567890
>    - Content-type: application/json
>
>
>
>
>
>    - *Response*:
>    {
>
>     "output": "hello Peter Green"
>
> }
>
>
>
> Now, ATS works until when the URI is always the same. If I change in the
> header Surname=Black, it goes to retrieve data from cache but in this case
> is should be forwarded to backend because the surname is different.
>
>
>
> What I want to do it to accept as key of request (to verify if it exists
> or not) also an header whitelist in order to say ok you have to retrieve
> from cache not just if the URI is the same but if *uri* + *surname*
> header value are the same.
>
> How I can include some headers to identify if the request (as a key) is an
> entry of my cache?
>
> Thanks
>
> Regards
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise confidential information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the e-mail by you is prohibited. Where allowed
> by local law, electronic communications with Accenture and its affiliates,
> including e-mail and instant messaging (including content), may be scanned
> by our systems for the purposes of information security and assessment of
> internal compliance with Accenture policy. Your privacy is important to us.
> Accenture uses your personal data only in compliance with data protection
> laws. For further information on how Accenture processes your personal
> data, please see our privacy statement at
> https://www.accenture.com/us-en/privacy-policy.
>
> ______________________________________________________________________________________
>
> www.accenture.com
>
>

RE: [External] Re: how manage headers in cache

Posted by "Divittorio, Vincenzo" <vi...@accenture.com>.
Hello,
I donā€™t want to add header in the response but to identiy an unique request I need to evaluate URI request and only one header in the request.
You imagine that I have a rqeust that accept name in query param and surname in the header.
The response will return ā€œHello Name surnameā€. It means that to understand if the request is unique or not, if the request is already present or not I need to evaluate also one header in the request.

If I evaluate just the URI it is not sufficient

Example
Request 1 /get/username?name=Peter
HEADER
Surname: Green

Response Hello Peter Green

Request 2 /get/username?name=Peter
HEADER
Surname: Black

Response Hello Peter Black

If I will evaluate just the header I will not able if we are talking about Peter Green or Peter Black.
So finally how I can evaluate also an header in the request?

Thanks


From: David Carlin <dc...@apache.org>
Sent: lunedƬ 11 febbraio 2019 13:52
To: users@trafficserver.apache.org; Divittorio, Vincenzo <vi...@accenture.com>
Subject: [External] Re: how manage headers in cache

Vincenzo,

What if you add "Vary:  Surname" header to the origin response?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary<https://urldefense.proofpoint.com/v2/url?u=https-3A__developer.mozilla.org_en-2DUS_docs_Web_HTTP_Headers_Vary&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=oeZEV71gGZEKIeCNau7I0lfxMDv3MCedSoVBDtsI9MY&e=>

Also be aware of this ATS setting which controls the maximum number of alternates for an object in cache (for a given URI):

https://docs.trafficserver.apache.org/en/latest/admin-guide/files/records.config.en.html?highlight=empty#proxy-config-cache-limits-http-max-alts<https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_files_records.config.en.html-3Fhighlight-3Dempty-23proxy-2Dconfig-2Dcache-2Dlimits-2Dhttp-2Dmax-2Dalts&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=trsxp1_pf_DhVrLtthikdhBYuVvVYabPc_CEP-t4dC4&e=>

If you expect lots of alternates, I would consider the cachekey plugin so that you can make the request header part of the cache key:

https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/cachekey.en.html<https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.trafficserver.apache.org_en_latest_admin-2Dguide_plugins_cachekey.en.html&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=K-bMLOPfL3Cp4TJDg6Hodq68Y11D3KkJ6ssZnkz4Yhk&e=>

David



On Mon, Feb 11, 2019 at 7:43 AM Divittorio, Vincenzo <vi...@accenture.com>> wrote:
Hi all,
Iā€™m using ATS as reverse proxy cache.
It works for HTTP GET request with parameter in URL.
My question is: can we add to the request key also some headers?

This is the example: I have following request
URI: http://myhost:myport/cxf/stubs/ats/username?name=Peter<https://urldefense.proofpoint.com/v2/url?u=http-3A__10.1.65.73-3A18009_cxf_expo20_jaws_stubs_ats_username-3Fname-3DPeter&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=nsV__I40yD7vHZxsO42FPFt3gWL4Bb_P7rT1RrUHG-kYWyc9mkNvj7z_a9YHfsi9&m=QXdAsgAblWKAKBH5DVuTWutlYPER7sJMY-ZyASvPkfY&s=D1a8k1j6vWitg8dAS0stN9clWe8RQw_y5pip8obMXpc&e=>
Headers:

  *   Surname: Green
  *   Timestamp: 1234567890
  *   Content-type: application/json



  *   Response:
{
    "output": "hello Peter Green"
}

Now, ATS works until when the URI is always the same. If I change in the header Surname=Black, it goes to retrieve data from cache but in this case is should be forwarded to backend because the surname is different.

What I want to do it to accept as key of request (to verify if it exists or not) also an header whitelist in order to say ok you have to retrieve from cache not just if the URI is the same but if uri + surname header value are the same.
How I can include some headers to identify if the request (as a key) is an entry of my cache?
Thanks
Regards












________________________________

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
______________________________________________________________________________________

www.accenture.com<http://www.accenture.com>