You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Elli <le...@yahoo.com> on 2012/04/25 13:39:16 UTC
Priority of remap.config rules
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:8080 http://www.yahoo.com
regex_map http://.*.server.net:8080 http://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
Re: Priority of remap.config rules
Posted by Conan <co...@gmail.com>.
My test result: regex_remap is prior to map sometimes.
#remap.config
map http://forbidden.test.com http://test.com @action=deny
# work
map http://www.test.com http://some.test.com
# not work
regex_map http://(.*).test.com http://$1.org.test.com
# catch all
map http://www1.test.com http://some.test.com
# not work too
related docs:
http://trafficserver.apache.org/docs/trunk/admin/configuration-files/remap.config.en.html#precedence
On Sat, Apr 28, 2012 at 2:21 AM, Leif Hedstrom <zw...@apache.org> wrote:
> On 4/27/12 10:13 AM, Elli wrote:
>
>> Thank you for the clarification. For what it's worth I agree it would
>> make configuration easier to understand. I will try to file a bug shortly.
>>
>>
> I'm pretty sure there already is a bug file for this :).
>
> -- leif
>
>
Re: Priority of remap.config rules
Posted by Leif Hedstrom <zw...@apache.org>.
On 4/27/12 10:13 AM, Elli wrote:
> Thank you for the clarification. For what it's worth I agree it would make configuration easier to understand. I will try to file a bug shortly.
>
I'm pretty sure there already is a bug file for this :).
-- leif
Re: Priority of remap.config rules
Posted by Elli <le...@yahoo.com>.
Thank you for the clarification. For what it's worth I agree it would make configuration easier to understand. I will try to file a bug shortly.
Thank you.
----- Original Message -----
From: Leif Hedstrom <zw...@apache.org>
To: users@trafficserver.apache.org
Cc: Elli <le...@yahoo.com>
Sent: Wednesday, April 25, 2012 3:06 PM
Subject: Re: Priority of remap.config rules
On 4/25/12 6:42 AM, Elli wrote:
>
> 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.
Yeah, that sounds like a 'bug' in the docs. File a bug and attach a fix? :)
All map rules have the highest precedence :-/. This is a serious problem
IMO, but hasn't been prioritized by anyone to fix. IMO, remap.config should
be strict ordering of the rules, regardless of the type of mapping.
-- Leif
Re: Priority of remap.config rules
Posted by Leif Hedstrom <zw...@apache.org>.
On 4/25/12 6:42 AM, Elli wrote:
>
> 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.
Yeah, that sounds like a 'bug' in the docs. File a bug and attach a fix? :)
All map rules have the highest precedence :-/. This is a serious problem
IMO, but hasn't been prioritized by anyone to fix. IMO, remap.config should
be strict ordering of the rules, regardless of the type of mapping.
-- Leif
Re: Priority of remap.config rules
Posted by Elli <le...@yahoo.com>.
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 <se...@hotmail.com>
To: users@trafficserver.apache.org
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: leman_1@yahoo.com
> Subject: Priority of remap.config rules
> To: users@trafficserver.apache.org
>
> 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
RE: Priority of remap.config rules
Posted by Servalan eq <se...@hotmail.com>.
Leif posted on something like thishttps://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: leman_1@yahoo.com
> Subject: Priority of remap.config rules
> To: users@trafficserver.apache.org
>
> 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:8080 http://www.yahoo.com
> regex_map http://.*.server.net:8080 http://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