We have a private network where we have our apps installed on Apache virtual host like:
http://extranet.domain.com
or http://calendar.domain.com
Everything works fine. Now we need to make one of these apps available from outside of our network.
Our only machine with public access is the zimbra (mail) server... where I tried to configure a reverse proxy but it's not working... I added this to /etc/nginx/sites-enabled/default
location /extranet/ {
proxy_pass http://extranet.domain.com/;
proxy_http_version 1.1;
proxy_set_header Accept-Encoding "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
If I try the external URL from a external network like this:
http://zimbra.externaldomain.com/extranet/login
I can reach to the login page and login but after the redirect it losses the extranet part of the URL so it goes nowhere... the where I got is
http://zimbra.externaldomain.com/home
Instead of
http://zimbra.externaldomain.com/extranet/home
Any help or clue?
Beware the trailing slash:
proxy_pass http://extranet.domain.com/;
, it is a valid URI. So nginx will replace your matched request with this.If your matched location is
/extranet/
, and you pass it with a URI, like/extranet/someurl
, the nginx proxy pass will replace the matched location with its own URI, in your case/
.So, the route
/extranet/someurl
will become/someurl
.For reference