Welcome! Log In Create A New Profile

Advanced

Re: Map capture doesn't work?

Maxim Dounin
February 03, 2012 09:54AM
Hello!

On Fri, Feb 03, 2012 at 07:37:44PM +0700, Edho Arief wrote:

> Taken directly from example[1]:

This example is incorrect.

>
> 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;
> }
>
> Accessing http://yutsuki.myconan.net/cc/whatever redirects to
> http://animebsd.net/$suffix ($suffix literal).

Map directive currently supports *variable* (single one) as a
second parameter, but not a string with variables. I.e. this will
work:

map $uri $new {
~^/cc/(?P<suffix>.*)$ $suffix;
}

but the above doesn't.

Maxim Dounin

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Map capture doesn't work?

Edho Arief 1174 February 03, 2012 07:40AM

Re: Map capture doesn't work?

António P. P. Almeida 375 February 03, 2012 09:38AM

Re: Map capture doesn't work?

Maxim Dounin 609 February 03, 2012 09:54AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 236
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready