Problems getting case insensitive match to work


#1

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;
     }

 }

}


#2

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).


#3

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


#4

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 ~*)