Use /g (global) regex modifier in map

Gabriel Arrais lists at
Fri Aug 8 06:37:39 UTC 2014

Is it possible somehow to use the global modifier in a regex map match?

I'm trying to use the map directive to filter the query string leaving
my proxy_cache_key with only known parameters.

For the first test I've tried to use a map like below to just catch all
parameters without really filtering them without success. In this case,
the variable $args_filtered ends empty.

    map $args $args_filtered {
        "~(?<list>[^=]*=[^&]+)/g"  $list;
        default  /;


When I try the same map, without the /g modifier at the end of the
expression, the variable $args_filtered ends with only the first query
string parameter in it.

Posted via

More information about the nginx mailing list