On Jun 11, 2014, at 1:29 AM, geo...@free.fr wrote: >>> I want to keep objects like media (avi|jpg|mp3) for 7 days in cache while >>> telling the client "max-age=3d", keep office file for 3 >>> days in cache while telling the client 1 day (using ATS 4.1.2 TTL are in >>> seconds) >> >> I think you are overcomplicating things a bit though, use the protocol :). >> http://tools.ietf.org/html/rfc7234#section-5.2.2.9, e.g. >> >> Cache-Control: max-age=259200, s-maxage=604800 >> >> This would be so easy if you could just configure your origin servers to >> behave and send the above. Barring that, you could use >> header_rewrite to modify the origin server response to just that. I just >> cringe when people have to fight poorly configured origin >> servers, this stuff belongs on the origin, and not on the caches. >
Besides using the old version of ATS, which is not supported, your config acts slightly oddly. I think it might even be a bug (it doesn’t run the rules in the order you’d expect, i.e. it matches the second regex first). > Leif, > thanks for the reminder but I don't really have this choice by now. > Still trying to use regex_map with header_rewrite plugin with > cond %{SEND_RESPONSE_HDR_HOOK} > cond %{PATH} "/(avi|mp3|jpg)$/" > rm-header Cache-Control > add-header Cache-Control max-age=3d > cond %{PATH} "/(doc|xls|ppt)$/" > rm-header Cache-Control > add-header Cache-Control max-age=1d The “expected” syntax for this rule is / was e.g. cond %{SEND_RESPONSE_HDR_HOOK} cond %{PATH} /(avi|mp3|jpg)$/ rm-header Cache-Control add-header Cache-Control max-age=3d [L] cond %{SEND_RESPONSE_HDR_HOOK} cond %{PATH} /(doc|xls|ppt)$/ rm-header Cache-Control add-header Cache-Control max-age=1d [L] (note that you shouldn’t have to use “” around the regexes). I’ll file a bug on the other issue in a bit, your syntax technically works, but ordering seems wrong. — Leif