what is my syntax error

Sergey A. Osokin osa at freebsd.org.ru
Thu Mar 7 20:37:34 UTC 2024


On Thu, Mar 07, 2024 at 03:20:23PM -0500, Victor Oppenheimer wrote:
> In my nginx.conf file on my Windows computerI have the following code in
> nginx.conf.
> 
> http { # http context specific to HTTP affecting all virtual servers
> 
> # force incoming URLs to lower case
>     map $uri $lowercase {~ ^(.+)$ /$1};

You may need to remove space after tilde symbol, after that
everything works as expected:

map $uri $lowercase {
        ~^(.+)$ /$1;
}

server {
        listen 80;
        location / {
                return 200 "lowercase=$lowercase\n";
        }
}

Test:

% curl 127.1:80/foobar
lowercase=//foobar


-- 
Sergey A. Osokin


More information about the nginx mailing list