I have the following configuration as L4 proxy over Nginx and everything works fine.
stream {
map $ssl_preread_server_name $name {
hostnames;
.ipchicken.com $ssl_preread_server_name;
.bbc.com $ssl_preread_server_name;
.bbc.co.uk $ssl_preread_server_name;
.bbci.co.uk $ssl_preread_server_name;
.neverssl.com $ssl_preread_server_name; #<-------
}
server {
resolver 8.8.8.8;
listen 443;
ssl_preread on;
proxy_connect_timeout 5s;
proxy_pass $name:$server_port;
}
But when HTTP site is requested, like "http://neverssl.com/" Nginx is not responding. Any idea for this issue?
As far a I know
ssl_preread
directive works only with HTTPS protocol. I don't know how to get HTTPHost
header value in thengx_stream_core_module
. You can try to use an additionalserver
block in the http context like shown here:There is no need to use
$server_port
variable at the stream server block, you are listening on the 443 port only, so you can just useproxy_pass $name:443;