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_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;
  • 1
    pre_read proxying answered really well here (second answer): stackoverflow.com/questions/34741571/… ; 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. Commented Feb 6, 2018 at 15:50
  • Do you mind posting it as answer so I can accept it?
    – Maxithi
    Commented Feb 7, 2018 at 7:21


You must log in to answer this question.

Browse other questions tagged .