You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Ethan Lai <yz...@yahoo.com> on 2014/03/17 15:39:37 UTC

(regex_)redirect after map replacement

Hi,

As I know, map rules have type
precedence<http://trafficserver.readthedocs.org/en/latest/reference/configuration/remap.config.en.html#precedence>
.
And current traffic server doesn't map target to replacement recursively.

However, after a successful map rule, another (regex_)redirect rule still
take effect.  Just wondering is this expected behavior or not?


I'd want traffic server to be my SSL termination, and I'd also redirect
non-SSL requests to SSL URLs.

With following remap.config, the final response will be HTTP 301 with
https://real-www.test.example.com Location header.


map https://www.example.com/   http://real-www.example.com/
regex_redirect http://([\w\.\-]+)\.abc.com/  https://$1.abc.com/


Since remap rules are first matched, would it be better to stop redirect
match after a success map?


Patch file, which only tests redirect rules after url_remap failed, is
attached, please comment.

Thanks,
-Ethan

Re: (regex_)redirect after map replacement

Posted by Ethan Lai <yz...@yahoo.com>.
Sorry, correct remap.config as below

map https://www.example.com/   http://real-www.example.com/
regex_redirect http://([\w\.\-]+)\.example.com/  https://$1.example.com/




Thanks,
-Ethan


2014-03-17 22:39 GMT+08:00 Ethan Lai <yz...@yahoo.com>:

> Hi,
>
> As I know, map rules have type precedence<http://trafficserver.readthedocs.org/en/latest/reference/configuration/remap.config.en.html#precedence>
> .
> And current traffic server doesn't map target to replacement recursively.
>
> However, after a successful map rule, another (regex_)redirect rule still
> take effect.  Just wondering is this expected behavior or not?
>
>
> I'd want traffic server to be my SSL termination, and I'd also redirect
> non-SSL requests to SSL URLs.
>
> With following remap.config, the final response will be HTTP 301 with
> https://real-www.test.example.com Location header.
>
>
> map https://www.example.com/   http://real-www.example.com/
> regex_redirect http://([\w\.\-]+)\.abc.com/  https://$1.abc.com/
>
>
> Since remap rules are first matched, would it be better to stop redirect
> match after a success map?
>
>
> Patch file, which only tests redirect rules after url_remap failed, is
> attached, please comment.
>
> Thanks,
> -Ethan
>