Mapping to change URL

Sergey A. Osokin osa at
Thu Oct 28 09:31:45 UTC 2021

Hi Tony,

hope you're doing well.

On Thu, Oct 28, 2021 at 08:22:53AM +0000, tony tabone wrote:
> I am trying to add a mapping to change the url being shown with every location. Do you know if this is possible since an error is being encountered on the mapping.
>     map $geoip2_data_country_code $leovegas_com_index_file $request_uri $new {
>       default /index-en.html default 0;
>       MT /en-desktop.html ~^/tony/ maintenance.tony;
>     }

According to the http_map module's documentation the map directive creates
a new variable whose value depends on values of one or more of the source
variables specified in the first parameter

In other words, the map directive expects only two variables: a source
and a destination.

> nginx: [emerg] invalid number of arguments in "map" directive in /etc/nginx/nginx.conf:91

When nginx starts, it validates its configuration file and fails on
incorrect usage of a directive.

It seems like at least more than one map directive (probably two or three)
need to be added to resolve the problem.

Sergey Osokin

More information about the nginx mailing list