1

I have setup Nginx as a reverse proxy listening to the 443 port for several blogs. I'd like to have Nginx pass a specific sub-domain to Stunnel to have a less-detectable VPN as shown below. Server port 443 setup

Is it possible to make Nginx redirect a sub-domain, regardless of the SSL, without interfering with Stunnel's encapsulation? I'm not sure the configuration below would work properly. Or should I use another setup?

server {
    listen 443;
    listen [::]:443;
    server_name sub.primary.tld;

    location / {
        proxy_pass http://127.0.0.1:1995/;
        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
    }
}
Maxithi
  • 111
  • 1
  • 3
  • 1
    pre_read proxying answered really well here (second answer): https://stackoverflow.com/questions/34741571/nginx-tcp-forwarding-based-on-hostname/40135151 ; The http redirect part will require additional server sections for forwarding, but it's not transparent to vpn clients anyway, so it's probably not worth configuring. – Andrew Domaszek Feb 06 '18 at 15:50
  • Do you mind posting it as answer so I can accept it? – Maxithi Feb 07 '18 at 07:21

0 Answers0