Reputation: 459
With the stream block in nginx, TCP proxy is not available in nginx. With SSL passthrough configuration it can pass the client certificate all the way to the backend service for verification.
I want to redirect this TCP connection from nginx with all the certificates to https endpoint of same service
Updated question: So request is coming for http://demo.local which need to be redirected to https://demo.local then do SSL passthrough after redirect for https request
----> Nginx configuration
http {
server {
listen 80;
server_name demo.local;
location / {
return 302 https://demo.local$request_uri
}
}
}
stream {
# main log compatible format
log_format stream '$remote_addr - - [$time_local] "$ssl_preread_server_name -> $name ($protocol)" '
'$status $bytes_sent "" "" "" ';
map $ssl_preread_server_name $name {
demo.local pt-up-demo.local;
}
upstream pt-up-demo.local {
server 127.0.0.1:5000;
}
upstream proxy-up-demo.local {
server x.x.x.x:8080;
}
server {
listen 5000 proxy_protocol;
proxy_pass proxy-up-demo.local'
}
server {
listen 443;
proxy_pass $name;
proxy_protocol on;
ssl_preread on;
access_log /dev/stdout stream;
}
}```
Upvotes: 0
Views: 1443
Reputation: 123461
A HTTP redirect is done at the HTTP level not at the HTTPS level. In order to let nginx issue this redirect the TLS connection needs to be terminated by nginx - which conflicts with the SSL passthrough you want.
Upvotes: 1