T
T
TechNOIR2020-04-21 20:00:25
Nginx
TechNOIR, 2020-04-21 20:00:25

nginx. Different proxy_pass depending on where the client is from. How to do?

Good afternoon.

There is a site with nginx (let's say srv.test.com).
It has an external ip, let's say 5.20.10.23 And an internal
192.168.100.20
In nginx, there is a location / ops ://192.168.100.20:5443 } and if external srv.test.com (5.20.10.23) then location /ops { proxy_pass https://5.20.10.23:5443 } Maybe it's in nginx? If yes, then how to do it? thanks in advance


Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Dmitriev, 2020-04-21
@SignFinder

Too lazy to google? Something like
location /ops {
if ($remote_addr = 192.168.100.0/24) {
proxy_pass https://192.168.100.20:5443;
}
proxy_pass https://5.20.10.23:5443;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question