Redirection issues running on a VM Network

Having some trouble getting to the admin panel on MIAB running on an VM Network (running a dedicated server with ESXI, Routes requests to it’s internal network which are then routed to the appropriate guest).

Everything installed correctly and all the services are all running, However whenever i try to get to the /admin route for the post-installation setup i get stuck in a redirect loop.

EDIT - Just to clarify, the issue occurs when I’m trying to get to mail.mydomain.com/admin to set up users and all that other stuff. MIAB is installed, running and requests are going to the correct guest VM, but a redirect loop is preventing /admin from loading.

Currently the routing goes like this;

  • Open internet > ESXI Host > Debian “bounce box” running NGINX > Guest VM

the bounce box is running NGINX for reverse proxy, All it does is listen for a request, upgrades to https if required and passes the request on to the correct vm (will be adding the other entries for mail later), I think somewhere between this proxy pass and the MIAB’s internal proxy pass there’s a loop but i can’t for the life of me figure it out :frowning:

All the MIAB config is unchanged out of the box, Here’s the nginx config for the mail server on the bounce box;

server {
  listen [::]:80;
  listen 80;
  server_name mail.[redacted].com ;
  location /.well-known/acme-challenge {
    root /var/www/letsencrypt;
    try_files $uri $uri/ =404;
  }
  location / {
    rewrite ^ https://$host$request_uri? permanent;
  }
}

server {
  listen [::]:443 ssl http2;
  listen 443 ssl http2;
  server_name mail.[redacted].com ;
  ssl_certificate /etc/letsencrypt/live/mail.[redacted].com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/mail.[redacted].com/privkey.pem;
  include nginx_ssl.conf;
  location / {
    proxy_pass http://10.0.1.6;
    proxy_set_header Host            $host;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
  }
}

I’m not very sure but I guess MIAB by default runs on 443 so maybe that is a problem?

That sounds right. Mail-in-a-Box is listening on both port 80 (HTTP) and 443 (HTTPS), but port 80 always responds with a redirect to HTTPS. So the proxy_pass in the HTTPS block should use https: and not http: or else it will aways be proxying a redirect.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.