I should have noticed this earlier, precedence is documented here
http://trafficserver.apache.org/docs/trunk/admin/configuration-files/remap.config.en.html

Although that doc claims redirect takes precedence over regex_map, which 
doesn't seem to be the case.  It looks like map and regex_map both take 
precedence over redirect.






________________________________
From: Servalan eq <[email protected]>
To: [email protected] 
Sent: Wednesday, April 25, 2012 1:28 PM
Subject: RE: Priority of remap.config rules



Leif posted on something like this
https://issues.apache.org/jira/browse/TS-675
back in 03/11 for version 2.x saying that map rules take precedence over 
redirect rules - though I wasn't sure if this was being called a bug or not?

Can you write your regex_map rule to exclude beetroot.server.net?

cheers,
Servalan


> Date: Wed, 25 Apr 2012 04:39:16 -0700
> From: [email protected]
> Subject: Priority of remap.config rules
> To: [email protected]
> 
> Hello,
> 
> I am trying to configure a map and redirect rule in remap.config and wanted 
> to find out what the precedence of rules are.
> 
> From some experiments it looks like map rules in general take precendence 
> over redirect rules. 
> 
> 
> My use case is I have a regex_map rule which catches a set of urls.  For one 
> of those urls I want an exception that gets redirected.  The redirect rule is 
> listed first so I expected that rule to handle the request.  Instead the map 
> rule is catching the request. Is there some way to do this? I thought about 
> potentially using the regex remap plugin to handle the redirect but that 
> seems like an ugly hack.
> 
> For example if we set up
>  
> redirect      http://beetroot.server.net:8080http://www.yahoo.com
> regex_map http://.*.server.net:8080http://www.google.com
>  
> and we hit this with 
>  
> curl -v -o dontwant.txt beetroot.server.net:8080/images
>  
> we get a 302 from google to 
> Location: http://beetroot.server.net:8080/imghp
>  
>  
> If we remove the regex_map line we get a 301 from yahoo to
>  
> Location: http://www.yahoo.com/images
> 
> Thanks                   

Reply via email to