You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Jan-Frode Myklebust <ja...@tanso.net> on 2013/01/22 14:33:40 UTC
default maps in remap.conf
I would like to have a set of rules in remap.conf that maps all
requests that didn't match anything else to a set of backend hosts. I
tried adding this to the bottom of my remap.conf:
# Default to sending to webapps-vips, which hosts multiple sites:
regex_map http://.* http://webapps-vips.example.net/
regex_map https://.* http://webapps-vips.example.net/
But unfortunately these had precedence over my "redirect" rules, and
broke all redirects.. Is there any way to achieve this with ATS?
-jf
RE: default maps in remap.conf
Posted by Luca Rea <lu...@contactlab.com>.
That works if you have not "regex_redirect"...
RE: default maps in remap.conf
Posted by "Williamson, Brad" <Br...@disney.com>.
All of our rules are map except for a few regex_remap's at the end. But thanks for pointing that out, I was under the impression that it handled things in a top-down fashion since that's the way it is behaving now. Seems like that "Internal Priority" needs a bit more explanation where you might have more than one of the same type of rules.
Either we have been incredibly lucky, or rules of the same type (i.e. regex_remap) are handled in a top down fashion, since that catch-all would definitely break many other things that we have in place that work just fine stripping things off. And without a way of specifying which rule to process before another, that makes life difficult. The whole point of what we are doing in the remap.config is to send things that need to be resized/scaled/manipulated to a separate service to be handled there, specified by specific patterns in the URL.
Argh. Now I need to review the rules and make sure we aren't on thin ice. It's working beautifully so far.
Brad
http://trafficserver.apache.org/docs/trunk/admin/configuration-files/remap.config.en.html#Precedence
"Remap rules are not processed top-down, but based on an internal priority
map and reverse_map
redirect and redirect_temporary
regex_remap
regex_redirect and regex_redirect_temporary
"
-----Original Message-----
From: Jan-Frode Myklebust [mailto:janfrode@tanso.net]
Sent: Tuesday, January 22, 2013 9:20 AM
To: users@trafficserver.apache.org
Subject: Re: default maps in remap.conf
On Tue, Jan 22, 2013 at 3:10 PM, Williamson, Brad <Br...@disney.com> wrote:
> We use this as a catch-all at the end of the remap list (i.e. the LAST line in remap.config). It does not conflict with earlier rules in our experience, we pick stuff off at various rules all over the place.
>
> regex_map http://([a-z\-0-9\.]+)
> http://our.internal.catchall-server.com/
>
I (painfully) discovered that that trailing regex_map had precedence over all my "redirects" earlier in the file. Ref:
http://trafficserver.apache.org/docs/trunk/admin/configuration-files/remap.config.en.html
which says:
""" Remap rules are not processed top-down, but based on an internal priority
* map and reverse_map
* redirect and redirect_temporary
* regex_remap
* regex_redirect and regex_redirect_temporary """
.. not quite sure where regex_map fits in to that priority, but it seemed to have the same priority as "map".
-jf
Re: default maps in remap.conf
Posted by Leif Hedstrom <zw...@apache.org>.
On 1/26/13 4:23 PM, Jan-Frode Myklebust wrote:
> On Tue, Jan 22, 2013 at 11:27 PM, McClimont, Aaron (SACE Board)
>
>> I came across this, which may help. Add this as the last entry in the remap.conf configuration:
>>
>> map / http://kitchensink.example.com
>>
>>
> Thanks for the suggestion and pointer, but I just tested this, and
> this map also overrides my earlier redirects:
>
> I.e. for:
>
> redirect http://www.example.com/ https://www.example.com/
> map https://www.example.com/ http://backend1.internal/
> map / http://backend2.internal
>
>
yes, it's lame, and we have a long oustanding bug on the issue. One thing
that can work is to use the regex_remap plugin, and only have one remap rule
per domain. From within the regex_remap rule, you can do redirects or
"mapping" as you fit, based on first come first serve regex rules.
-- Leif
Re: default maps in remap.conf
Posted by Jan-Frode Myklebust <ja...@tanso.net>.
On Tue, Jan 22, 2013 at 11:27 PM, McClimont, Aaron (SACE Board)
> I came across this, which may help. Add this as the last entry in the remap.conf configuration:
>
> map / http://kitchensink.example.com
>
>
Thanks for the suggestion and pointer, but I just tested this, and
this map also overrides my earlier redirects:
I.e. for:
redirect http://www.example.com/ https://www.example.com/
map https://www.example.com/ http://backend1.internal/
map / http://backend2.internal
the last rules is in effect for all http://, including http://www.example.com/.
I'm afraid I will have to handle the redirects on the backends instead
of on ATS...
-jf
RE: default maps in remap.conf
Posted by "McClimont, Aaron (SACE Board)" <Aa...@saceboard.sa.gov.au>.
Jan,
I came across this, which may help. Add this as the last entry in the remap.conf configuration:
map / http://kitchensink.example.com
Sourced from a presentation by Leif Hedstrom on ATS in Dec 2011 (Page 37): http://static.usenix.org/events/lisa11/tech/slides/hedstrom.pdf
Regards,
Aaron McClimont
-----Original Message-----
From: Jan-Frode Myklebust [mailto:janfrode@tanso.net]
Sent: Wednesday, 23 January 2013 12:50 AM
To: users@trafficserver.apache.org
Subject: Re: default maps in remap.conf
On Tue, Jan 22, 2013 at 3:10 PM, Williamson, Brad <Br...@disney.com> wrote:
> We use this as a catch-all at the end of the remap list (i.e. the LAST line in remap.config). It does not conflict with earlier rules in our experience, we pick stuff off at various rules all over the place.
>
> regex_map http://([a-z\-0-9\.]+)
> http://our.internal.catchall-server.com/
>
I (painfully) discovered that that trailing regex_map had precedence over all my "redirects" earlier in the file. Ref:
http://trafficserver.apache.org/docs/trunk/admin/configuration-files/remap.config.en.html
which says:
""" Remap rules are not processed top-down, but based on an internal priority
* map and reverse_map
* redirect and redirect_temporary
* regex_remap
* regex_redirect and regex_redirect_temporary """
.. not quite sure where regex_map fits in to that priority, but it seemed to have the same priority as "map".
-jf
Re: default maps in remap.conf
Posted by Jan-Frode Myklebust <ja...@tanso.net>.
On Tue, Jan 22, 2013 at 3:10 PM, Williamson, Brad
<Br...@disney.com> wrote:
> We use this as a catch-all at the end of the remap list (i.e. the LAST line in remap.config). It does not conflict with earlier rules in our experience, we pick stuff off at various rules all over the place.
>
> regex_map http://([a-z\-0-9\.]+) http://our.internal.catchall-server.com/
>
I (painfully) discovered that that trailing regex_map had precedence
over all my "redirects" earlier in the file. Ref:
http://trafficserver.apache.org/docs/trunk/admin/configuration-files/remap.config.en.html
which says:
""" Remap rules are not processed top-down, but based on an internal priority
* map and reverse_map
* redirect and redirect_temporary
* regex_remap
* regex_redirect and regex_redirect_temporary
"""
.. not quite sure where regex_map fits in to that priority, but it
seemed to have the same priority as "map".
-jf
RE: default maps in remap.conf
Posted by "Williamson, Brad" <Br...@disney.com>.
We use this as a catch-all at the end of the remap list (i.e. the LAST line in remap.config). It does not conflict with earlier rules in our experience, we pick stuff off at various rules all over the place.
regex_map http://([a-z\-0-9\.]+) http://our.internal.catchall-server.com/
-Brad
-----Original Message-----
From: Jan-Frode Myklebust [mailto:janfrode@tanso.net]
Sent: Tuesday, January 22, 2013 8:34 AM
To: users@trafficserver.apache.org
Subject: default maps in remap.conf
I would like to have a set of rules in remap.conf that maps all requests that didn't match anything else to a set of backend hosts. I tried adding this to the bottom of my remap.conf:
# Default to sending to webapps-vips, which hosts multiple sites:
regex_map http://.* http://webapps-vips.example.net/ regex_map https://.* http://webapps-vips.example.net/
But unfortunately these had precedence over my "redirect" rules, and broke all redirects.. Is there any way to achieve this with ATS?
-jf