Forum: NGINX Problems getting case insensitive match to work

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C9b102f09f7595251ca921012687f8a7?d=identicon&s=25 Mario Gazzo (Guest)
on 2008-11-06 10:57
(Received via mailing list)
I have for some reasons difficulties to get the following nginx setup
to respond case insensitive to www.mydomain.dk/demo. It only responds
to www.mydomain.dk/Demo. Shouldn't "~*" make the match case
insensitive? The nginx reverseproxy server runs linux whereas the
application server is Windows Server 2003 with IIS.

What am I doing wrong?

Cheers
Mario

worker_processes  1;

events {
     worker_connections  1024;
}

http {
     include    mime.types;
     include    proxy.conf;
     default_type  application/octet-stream;

     sendfile        on;
     keepalive_timeout  65;

     upstream demo_hosts {
           server  192.168.0.97:80;
     }

server {
         listen 80;

         server_name  www.mydomain.dk;

         location ~* /Demo {
           proxy_pass http://demo_hosts/Demo;
         }

     }
}
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2008-11-06 11:30
(Received via mailing list)
On Thu, Nov 06, 2008 at 10:49:50AM +0100, Mario Gazzo wrote:

>
>
>         server_name  www.mydomain.dk;
>
>         location ~* /Demo {
>           proxy_pass http://demo_hosts/Demo;
>         }
>
>     }
> }

Try

         location ~* ^/Demo {
           proxy_pass http://demo_hosts;
         }

proxy_pass inside location with regex may not have URI part (/Demo).
C9b102f09f7595251ca921012687f8a7?d=identicon&s=25 Mario Gazzo (Guest)
on 2008-11-06 13:02
(Received via mailing list)
Thanks a lot. This worked.

How is the ^ interpreted in NGINX? I did not find any examples/
documentation that indicated this was necessary. I like to understand
why I need it.

Cheers
Mario
B06eeb3c664683b78f1bd62a80cd8ca4?d=identicon&s=25 Roxis (Guest)
on 2008-11-06 13:28
(Received via mailing list)
On Thursday 06 November 2008, Mario Gazzo wrote:
> Thanks a lot. This worked.
>
> How is the ^ interpreted in NGINX? I did not find any examples/
> documentation that indicated this was necessary. I like to understand
> why I need it.

Read about basic regex.

^ is interpreted by PCRE
because you are using a regex location (location ~ or location ~*)
This topic is locked and can not be replied to.