You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by "Vaughan, Wendre" <we...@soundtransit.org> on 2018/10/11 16:35:12 UTC

How to configure ATS to support X-Cache-Tags header?

I have ATS 7.1 setup as a reverse proxy for a Drupal-Managed Website.  My Drupal Development Team wants to use a feature called Cache Tags (https://www.drupal.org/docs/8/api/cache-api/cache-tags-varnish ) that is designed specifically for Varnish.

The Drupal system would send a Request with method ‘BAN’ to the ATS servers expecting the ATS servers to read the X-Cache-Tags headers (a list of pages to not cache) and have ATS do the following:


  1.  Purge the ATS cache of any of the items in the X-Cache-Tags list
  2.  Dynamically update a list of ‘Never Cache’ to the items in the X-Cache-Tag list.
  3.  Remove these four headers from origin responses before sending the response to the requestor:  X-Url, X-Host, X-Cache-Tags, X-Cache-Contexts (can do this with the headers plugin)

So I have a few questions.  Can I setup a method called ‘BAN’ on the ATS servers?  I think I can use the headers plugin and possibly a lua script to do the purging and update the cache.config file.  If I can get the ‘BAN’ method to be accepted by ATS.

I am pretty new to extending ATS with lua.  Any help is appreciated.

Wendre Vaughan
Senior Software Engineer, Operations | Finance & Information Technology | Sound Transit
P: 206.903.7270 | F: 206.398.5223 | e: wendre.vaughan@soundtransit.org<ma...@soundtransit.org>

Connect with us
https://www.facebook.com/SoundTransit | https://twitter.com/SoundTransit

[id:image001.png@01D29738.02F09650]


Re: How to configure ATS to support X-Cache-Tags header?

Posted by Shu Kit Chan <ch...@gmail.com>.
I wrote a small prototype lua script here for supporting cache invalidation
through cache tags -

https://github.com/shukitchan/ats_lua_scripts/blob/master/cache_tags.lua

Should be a good starting point.

Kit

On Fri, Oct 12, 2018 at 12:38 AM Shu Kit Chan <ch...@gmail.com> wrote:

> I think as long as you allowed it in ip_allow.config properly, "BAN"
> method works.
>
> I think last time the community discussed about this feature, the
> conclusion is that you can probably achieve similar effect with the
> regex_revalidate plugin -
> https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/regex_revalidate.en.html
> or the purge remap plugin -
> https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/remap_purge.en.html
>
>
> I think you should be able to implement the mechanism you mentioned using
> lua. Although i am not too sure why you want to update cache.config. Since
> i thought the "ban" is just to invalidate the cache entry once and not
> indefinitely.
>
> Thanks
>
> kit
>
>
> On Thu, Oct 11, 2018 at 9:35 AM Vaughan, Wendre <
> wendre.vaughan@soundtransit.org> wrote:
>
>> I have ATS 7.1 setup as a reverse proxy for a Drupal-Managed Website.  My
>> Drupal Development Team wants to use a feature called Cache Tags (
>> https://www.drupal.org/docs/8/api/cache-api/cache-tags-varnish ) that is
>> designed specifically for Varnish.
>>
>>
>>
>> The Drupal system would send a Request with method ‘BAN’ to the ATS
>> servers expecting the ATS servers to read the X-Cache-Tags headers (a list
>> of pages to not cache) and have ATS do the following:
>>
>>
>>
>>    1. Purge the ATS cache of any of the items in the X-Cache-Tags list
>>    2. Dynamically update a list of ‘Never Cache’ to the items in the
>>    X-Cache-Tag list.
>>    3. Remove these four headers from origin responses before sending the
>>    response to the requestor:  X-Url, X-Host, X-Cache-Tags, X-Cache-Contexts
>>    (can do this with the headers plugin)
>>
>>
>>
>> So I have a few questions.  Can I setup a method called ‘BAN’ on the ATS
>> servers?  I think I can use the headers plugin and possibly a lua script to
>> do the purging and update the cache.config file.  If I can get the ‘BAN’
>> method to be accepted by ATS.
>>
>>
>>
>> I am pretty new to extending ATS with lua.  Any help is appreciated.
>>
>>
>>
>> Wendre Vaughan
>>
>> Senior Software Engineer, Operations | Finance & Information Technology |
>> Sound Transit
>>
>> P: 206.903.7270 | F: 206.398.5223 | e: wendre.vaughan@soundtransit.org
>>
>>
>>
>> Connect with us
>>
>> https://www.facebook.com/SoundTransit | https://twitter.com/SoundTransit
>>
>>
>>
>> [image: id:image001.png@01D29738.02F09650]
>>
>>
>>
>

Re: How to configure ATS to support X-Cache-Tags header?

Posted by Shu Kit Chan <ch...@gmail.com>.
I think as long as you allowed it in ip_allow.config properly, "BAN" method
works.

I think last time the community discussed about this feature, the
conclusion is that you can probably achieve similar effect with the
regex_revalidate plugin -
https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/regex_revalidate.en.html
or the purge remap plugin -
https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/remap_purge.en.html


I think you should be able to implement the mechanism you mentioned using
lua. Although i am not too sure why you want to update cache.config. Since
i thought the "ban" is just to invalidate the cache entry once and not
indefinitely.

Thanks

kit


On Thu, Oct 11, 2018 at 9:35 AM Vaughan, Wendre <
wendre.vaughan@soundtransit.org> wrote:

> I have ATS 7.1 setup as a reverse proxy for a Drupal-Managed Website.  My
> Drupal Development Team wants to use a feature called Cache Tags (
> https://www.drupal.org/docs/8/api/cache-api/cache-tags-varnish ) that is
> designed specifically for Varnish.
>
>
>
> The Drupal system would send a Request with method ‘BAN’ to the ATS
> servers expecting the ATS servers to read the X-Cache-Tags headers (a list
> of pages to not cache) and have ATS do the following:
>
>
>
>    1. Purge the ATS cache of any of the items in the X-Cache-Tags list
>    2. Dynamically update a list of ‘Never Cache’ to the items in the
>    X-Cache-Tag list.
>    3. Remove these four headers from origin responses before sending the
>    response to the requestor:  X-Url, X-Host, X-Cache-Tags, X-Cache-Contexts
>    (can do this with the headers plugin)
>
>
>
> So I have a few questions.  Can I setup a method called ‘BAN’ on the ATS
> servers?  I think I can use the headers plugin and possibly a lua script to
> do the purging and update the cache.config file.  If I can get the ‘BAN’
> method to be accepted by ATS.
>
>
>
> I am pretty new to extending ATS with lua.  Any help is appreciated.
>
>
>
> Wendre Vaughan
>
> Senior Software Engineer, Operations | Finance & Information Technology |
> Sound Transit
>
> P: 206.903.7270 | F: 206.398.5223 | e: wendre.vaughan@soundtransit.org
>
>
>
> Connect with us
>
> https://www.facebook.com/SoundTransit | https://twitter.com/SoundTransit
>
>
>
> [image: id:image001.png@01D29738.02F09650]
>
>
>