On May 13, 2014, at 12:14 PM, Daniel Biazus <[email protected]> wrote:

> Hi Guys,
> 
>     We've been using traffic server as a reverse proxy to delivery static 
> content across multiple CDN nodes, though the regex purge works as expected 
> through web UI tool, We've been facing some challenges regarding the cache 
> keys when the objects are stored in cache.
>     In order to have a better understanding of our scenario, let's take a 
> look at this example:
> 
> Scenario 1:
> 
> - traffic server is working as a reverse proxy:
> 
> #remap.config
> 
> map http://finalurl.foo.bar/   http://originserver.foo.bar/
> reverse_map  http://originserver.foo.bar/  http://finalurl.foo.bar/
> 
> - We have to purge all css files under the URL http://finalurl.foo.bar/
> 
> Considering this, we have to purge the following regex:
> 
> - http://finalurl.foo.bar/*.css
>     
> The example above doesn't work due the fact that traffic server uses the 
> origin URL to calculate the hash key, then, in this case we have to make a 
> purge request using the origin server URL (that's not nice with our clients, 
> right ?):
> 
> - http://originserver.foo.bar/*.css
> 
> So guys, anyone knows if there is a way to change the hash key in traffic 
> server, or even if is there some workaround to deal with this scenario ?


The common way of doing this is to have a plugin, that generates cache keys 
based on a combination of the URL and a generation ID. This would easily be 
configurable per remap rule, such that you can then instantly (O(1)) purge all 
objects for that remap rule simply by modifying (increasing) the generation ID. 
There is one such plugin in the public domain, although it probably needs a 
little loving. :) An easy adoption to that plugin would be to take the 
generation ID as an argument on the remap rule.

— Leif

Reply via email to