On 6/11/14, 12:29 AM, "geo...@free.fr" <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. > >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 > >I got this diag which shows only second %{PATH} condition is tested but >also ending with a strange message "PATH requires remap initialization! >Evaluating to false!". Even with a file named test.doc, no header rewrite >action is done : > >(header_rewrite) activated transaction hook via remap.config: new hook=5 >(header_rewrite_dbg) Calling CTOR for Resources (RemapAPI) >(header_rewrite) rri: 0x7fffffffb8e0 >(header_rewrite) Building resource structure for hook (17) >(header_rewrite) Adding TXN client request header buffers >(header_rewrite) Adding TXN client request header buffers for remap >instance >(header_rewrite) Appending PATH to evaluation value: test.avi >(header_rewrite) Evaluating PATH >(header_rewrite) Test regular expression (doc|xls|ppt)$ : test.avi >(header_rewrite) returing with status: 0 >(header_rewrite_dbg) Calling CTOR for Resources (InkAPI) >(header_rewrite) Building resource structure for hook (5) >(header_rewrite) Adding TXN client request header buffers >(header_rewrite) Adding TXN client response header buffers >(header_rewrite) PATH requires remap initialization! Evaluating to false! > > >(header_rewrite) activated transaction hook via remap.config: new hook=5 >(header_rewrite_dbg) Calling CTOR for Resources (RemapAPI) >(header_rewrite) rri: 0x7fffff6f90b0 >(header_rewrite) Building resource structure for hook (17) >(header_rewrite) Adding TXN client request header buffers >(header_rewrite) Adding TXN client request header buffers for remap >instance >(header_rewrite) Appending PATH to evaluation value: test.doc >(header_rewrite) Evaluating PATH >(header_rewrite) Test regular expression (doc|xls|ppt)$ : test.doc >(header_rewrite) Successfully found regular expression match >(header_rewrite) OperatorRMHeader::exec() invoked on header Cache-Control >(header_rewrite) OperatorAddHeader::exec() invoked on header >Cache-Control: max-age=1d >(header_rewrite) adding header Cache-Control >(header_rewrite) returing with status: 0 >(header_rewrite_dbg) Calling CTOR for Resources (InkAPI) >(header_rewrite) Building resource structure for hook (5) >(header_rewrite) Adding TXN client request header buffers >(header_rewrite) Adding TXN client response header buffers >(header_rewrite) PATH requires remap initialization! Evaluating to false! > You may want to upgrade to ats-5.0.x, if that¹s a possibility - I see this error too on ats-4.0, but, it works fine in 5.0 version. > >regards, >Denis