Z
Z
Zamorozka2011-12-02 14:31:50
Nginx
Zamorozka, 2011-12-02 14:31:50

Is proxy_pass inherited in nested locations in nginx?

Let's say we have an nginx config:
location /webapp {
location /webapp/user {
if ($arg_callback = '') {
return 403;
}
}
client_max_body_size 150m;
proxy_pass localhost :8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
In this case, /webapp/user is not proxied.
If I duplicate the proxy_pass configuration from the first location (/webapp), then everything starts working.
I really would not want to copy-paste proxy_pass, so who knows how to make it inherit?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2011-12-02
@BuriK666

use include

K
KawaiDesu, 2016-12-07
@KawaiDesu

proxy_pass is not inherited.
mailman.nginx.org/pipermail/nginx-ru/2013-Septembe...
mailman.nginx.org/pipermail/nginx-ru/2011-October/...
mailman.nginx.org/pipermail/nginx-ru/2013 -Septembe...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question