Quantcast

How to exact match a nginx location?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to exact match a nginx location?


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
nginx mailing list

I am configuring a nginx revser proxy. The result should be when user type http://10.21.169.13/mini, then the request should be proxy_pass to 192.168.1.56:5000. Here is the nginx config:
server {
        listen 80;
        server_name 10.21.169.13;

        location = /mini {
                proxy_pass http://192.168.1.65:5000;
                include /etc/nginx/proxy_params;
        }
}
The above location block never worked with http://10.21.169.13/mini. The only location block worked is:
server {
        listen 80;
        server_name 10.21.169.13;

        location  / {
                proxy_pass http://192.168.1.65:5000;
                include /etc/nginx/proxy_params;
        }
}
But the above config also match http://10.21.169.13 request which is too board.
What kind of location block will only match 'http://10.21.169.13/mini` and no more?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to exact match a nginx location?

Alex Samad
so (have a stab at this)

location = /mini {

equals 
http://10.21.169.13/mini and not  http://10.21.169.13/mini/ or anything else 
 http://10.21.169.13/mini/*

try
location /mini {
or
location  /mini/ {

A

On 28 March 2017 at 12:43, Jun Chen via nginx <[hidden email]> wrote:

I am configuring a nginx revser proxy. The result should be when user type http://10.21.169.13/mini, then the request should be proxy_pass to 192.168.1.56:5000. Here is the nginx config:
server {
        listen 80;
        server_name 10.21.169.13;

        location = /mini {
                proxy_pass http://192.168.1.65:5000;
                include /etc/nginx/proxy_params;
        }
}
The above location block never worked with http://10.21.169.13/mini. The only location block worked is:
server {
        listen 80;
        server_name 10.21.169.13;

        location  / {
                proxy_pass http://192.168.1.65:5000;
                include /etc/nginx/proxy_params;
        }
}
But the above config also match http://10.21.169.13 request which is too board.
What kind of location block will only match 'http://10.21.169.13/mini` and no more?

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Loading...