map module regular expression help

Dick Middleton dick at fouter.net
Fri Aug 26 11:47:55 UTC 2011


Hi,

	In the wiki for the map module (http://wiki.nginx.org/HttpMapModule) the
following is given as an example:

map $uri $myvalue {
    /aa                   /mapped_aa;
    ~^/aa/(?<suffix>.*)$  /mapped_bb/$suffix;
}


The second form, the regex, I can't get to work - it returns the literal text
rather than substituting for $suffix.

from my map block:

map $uri $locn {
    ~^/pdns(?<suffix>.*)$       /var/www/pdns$suffix;
}

the I rewrite:

  rewrite ^ $locn;

from the log:

open() "/var/www/pdns$suffix" failed

How do I get this to substitute?

This is using nginx/1.1.0 on debian squeeze.

Dick



More information about the nginx mailing list