I'm using nginx here as an example, but this is really more of a conceptual question about SSL termination and TCP that could apply to any web server.
Basically, if web server A receives TCP traffic on port 443 (the first nginx config) and then forwards that to web server B on port 1000 running HTTPS (the second nginx config), do I need to even have SSL configured for web server A?
As far as I understand, the answer is no, because web server A is ultimately just forwarding the encrypted traffic it gets on 443 "as is" to port 1000 to be decrypted by web server B. Basically:
client -> encrypted traffic -> web server A -> Pass through (encrypted) -> web server B -> decrypted traffic
However, on the first connection, does it matter than the traffic is temporarily unencrypted, as it routes through web server A before the SSL handshake is established. I've never had a setup where the client establishes an SSL connection to web server B via TCP over web server A, which is not encrypted, so I'm not sure if that is secure. I think it's still fine, as the SSL handshake itself occurs over an unencrypted TCP connection, but not quite sure.
events {}
stream {
server {
listen 443;
listen [::]:443;
proxy_pass 127.0.0.1:1250;
}
}
events {}
http {
server {
listen 1000 ssl http2;
listen [::]:1000 ssl http2;
ssl_certificate /etc/ssl/foo.crt;
ssl_certificate_key /etc/ssl/foo.pem;
# App
location / {
proxy_pass http://localhost:3000;
}
iptables
instead of nginx on server a. Therefore, there is no need to setup SSL on web server A. WRTon the first connection, does it matter than the traffic is temporarily unencrypted
- no. The initial (unencrypted) handshake passing through server a is no different than the initial unencrypted handshake passing through numerous routers when you connect directly to any HTTPS site.