Welcome! Log In Create A New Profile

Advanced

Reverse proxy with multiple hosts and subdomains

Posted by alxhoff 
Reverse proxy with multiple hosts and subdomains
October 17, 2016 09:20AM
Hi,

I am sorry if there is a topic covering this already but I have been unable to find anything after hours of searching. Or maybe I was unable to recognise that which I need. I am setting up a VM test mail server using the iRedMail package and having problems reverse proxying to the two default web UIs the package creates.

Running locally the server creates two web UIs at https://192.168.0.2/mail and https://192.168.0.2/iredadmin both of which are accessible. Now my big problem is using two separate hosts to access these two local sub-domains.

My first problem I have encountered is that the reverse proxy seems to redirect requests from host.example.com to http://local.ip/host automatically. Where the host name seems to be appended on the end of the local ip.

Such that my config of:

server {
listen 80;
servername mail.example.com;

location / {
proxy_pass https://192.168.0.2/mail;
}

returns an error that the domain mail.example.com/mailmail does not exist. I have also tried with the proxy pass having /mail/ on the end but this returns an error saying mail.example.com/mail/mail does not exist. Which made me realise that for some reason the host name is being appended onto the end of the domain as a sub-domain.

What am I missing or needing to read into about how nginx is appending the hostnames into the proxy pass?

Thank you.
Re: Reverse proxy with multiple hosts and subdomains
October 17, 2016 12:01PM
location /mail {
proxy_pass https://192.168.0.2;
}

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 176
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