K
K
Kulake2019-08-20 15:05:17
Nginx
Kulake, 2019-08-20 15:05:17

Nginx proxy_pass for 2 locations?

Now the config is like this.
location / {
proxy_pass http://192.168.1.72;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
#proxy_redirect off;
}
location /test {
proxy_pass 192.168.1.44/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
The essence of the problem:
There are two absolutely identical web servers, one of them for testing.
When you go to /test (test server), authorization appears. After passing authorization, it transfers to the main server /

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2019-08-20
@shambler81

proxy_pass 192.168.1.44/; you changed to http:// 192.168.1.44; or not ?
And as an option, do it through upstream
. For example, things are generally different,
I create a domain
dev.site.ru - I put a password on it, and open it for my ip.
As a result, I see the site and work even without a password.
and slash test is not that movie

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question