Welcome! Log In Create A New Profile

Advanced

Reverse-proxy

Posted by johnjore 
Reverse-proxy
September 05, 2011 01:58PM
I use nginx as a reverse-proxy for accessing a number of internal websites like zoneminder and nagios, and until now I've had a 1:1 mapping between the external URL and the internal server; http://dummy.dyndns.com/zoneminder serves up the contents from http://192.168.1.10/zoneminder

Works great.


What's not so great, is I've now got two identical internal URL's i wish to access from the outside. By adding a prefix url1 and url2, i was hoping to redirect the requests to two different internal servers much like:

http://dummy.dyndns.com/url1/ -> 192.168.1.21/
http://dummy.dyndns.com/url2/ -> 192.168.1.22/

I've tried various configurations with root, rewrite, alias, google searches etc but not found a working setup. I'm obiously missing something fundamental here. The easiest would be to put the two internal sites on different ports as service itself does not support adding a prefix, but i'd rather use a single port with a pre-fix as outlined above.


#HTPC01
location ~* (/url1|/url1/)$ {
rewrite url1(.*) http://192.168.1.21$1;
proxy_pass http://192.168.1.21;
proxy_redirect http://htpc01.internal.net/ https://dummy.dyndns.com/url1/;
}

#HTPC02
location ~* (/url2|/url2/)$ {
rewrite url2(.*) http://192.168.1.22$1;
proxy_pass http://192.168.1.22;
proxy_redirect http://htpc02.internal.net/ https://dummy.dyndns.com/url2/;
}


Help appreciated!


JJ

PS: The application in question is Remote Potato, allowing one to schedule recordings from the internet on an HTPC, but as described above, it runs as windows service and not on top of IIS.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 172
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready