On May 22, 2014, at 3:06 AM, geo...@free.fr wrote:

> Hi,
> I am trying to set up several rewrite header rules files to use one by a 
> regex_map rule based on tld.
> I can't get them parsed during ATS startup :
> ==> error.log <==
> 20140522.11h18m41s header_rewrite: failed to parse configuration file
> 
> I'm running FreeBSD 9.2 release, ATS 4.1.2 built from ports, all files are in 
> "/usr/local/etc/trafficserver" r+w by ATS processes. It work when using a 
> global
> 
> ==>remap.config
> regex_map http://www.foo.fr http://10.10.16.3/ plugin=header_rewrite.so 
> @pparam=/usr/local/etc/trafficserver/header_rewrite_fr.config
> regex_map http://www.foo.cz http://10.10.16.3/ plugin=header_rewrite.so 
> @pparam=/usr/local/etc/trafficserver/header_rewrite_cz.config

Your example remap.config should be @plugin=header_rewrite.so instead of 
plugin=header_rewrite.so.

> ==> plugin.config
> header_rewrite.so
> 
> ==>header_rewrite_cz.config
> cond %{READ_RESPONSE_HDR_HOOK} AND
> cond %{CLIENT-HEADER:Host} =www.foo.cz
> rm-header Cache-Control
> add-header Cache-Control max-age=4000 [L]
> 
> ==>header_rewrite_fr.config
> cond %{READ_RESPONSE_HDR_HOOK} AND
> cond %{CLIENT-HEADER:Host} =www.foo.fr
> rm-header Cache-Control
> add-header Cache-Control max-age=10000 [L]
> 
> No header changes are made at all :c

If you’re specifying header_rewrite.so in plugins.config, it needs a config 
file defined like you have below.

> Worst when I used a global configuration file to rewrite_header plugin
> ==> plugin.config
> header_rewrite.so /usr/local/etc/trafficserver/header_rewrite.config
> 
> ==>header_rewrite.config
> cond %{READ_RESPONSE_HDR_HOOK} AND
> cond %{CLIENT-HEADER:Host} =www.foo.cz
> rm-header Cache-Control
> add-header Cache-Control max-age=4000 [L]
> cond %{READ_RESPONSE_HDR_HOOK} AND
> cond %{CLIENT-HEADER:Host} =www.foo.fr
> rm-header Cache-Control
> add-header Cache-Control max-age=10000 [L]
> 
> # curl -I -H "Host: www.foo.fr" "http://10.10.16.28:8080/o5k";
> curl: (52) Empty reply from server

Can you enable diags and report the debug info in traffic.out?  You can do this 
by setting these two options in records.config and restarting trafficserver:
CONFIG proxy.config.diags.debug.enabled INT 1
CONFIG proxy.config.diags.debug.tags STRING header_rewrite.*

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to