0

Let's say I have two webservers running on https://server:10000 and https://server:10001, that is, SSL termination happens on my server, not on nginx.

I want nginx to route https://server0.mydomain.com to server:10000 and https://server1.mydomain.com to server:10001

I came up with the following, but how can I match based on hostname?

stream {
    upstream server0 {
        server server:10000;
    }

    server {
        listen 443;
        proxy_pass server0;
    }
}

This doesn't work because, I think, nginx wants to terminate ssl connection, instead of just passing the traffic through?

http {
    upstream server0 {
        server localhost:19080;
    }

    server {
        listen 443;

        location / {
            proxy_pass https://server0;
        }
    }
}

I saw this, https://stackoverflow.com/a/40135151/3515174 but ssl_preread doesn't appear to work on windows.

What are my options?

Community
  • 1
  • 1
Mardoxx
  • 4,372
  • 7
  • 41
  • 67

1 Answers1

1

I recompiled nginx with --with-stream_ssl_preread_module and followed this guide https://stackoverflow.com/a/40135151/3515174

Community
  • 1
  • 1
Mardoxx
  • 4,372
  • 7
  • 41
  • 67