Map capture doesn't work?
António P. P. Almeida
appa at perusio.net
Fri Feb 3 14:37:08 UTC 2012
On 3 Fev 2012 12h37 WET, edho at myconan.net wrote:
> Taken directly from example[1]:
>
> map $uri $new {
> default http://www.domain.com/home/;
>
> /aa http://aa.domain.com/;
> /bb http://bb.domain.com/;
> ~^/cc/(?P<suffix>.*)$ http://animebsd.net/$suffix;
> /john http://my.domain.com/users/john/;
> }
>
> server {
> server_name yutsuki.myconan.net;
> rewrite ^ $new redirect;
> }
I tripped over this a few days back. It seems that the capture doesn't
work if you had anything surrounding the variable that holds the
captured pattern to the right side of the map.
Right now the only thing that works is doing something like this:
- ~^/cc/(?P<suffix>.*)$ http://animebsd.net/$suffix;
+ ~^/cc/(?P<suffix>.*)$ $suffix;
Then add another map *just* for the host and do:
return 301 $host_map://$new;
--- appa
More information about the nginx-devel
mailing list