Automatically detect hostname with map als ssl preread

openworx nginx-forum at forum.nginx.org
Mon Feb 7 12:06:28 UTC 2022


I have a IPv4 to IPv6 reverse proxy server so that IPv4 clients can access
IPv6 only websites. For each website the website domain and the
corresponding IPv6 address must be added manually. Is there a way to
automatically detect the AAAA record from the website and use this in
upstream?

stream {
  map $ssl_preread_server_name $selected_upstream {
    www.website1.com upstream_1;
    www.website2.com upstream_2;
    www.website3.com upstream_3;
  }
  upstream upstream_1 { server [2001:x:x:x::f:244]:443; }
  upstream upstream_2 { server [2001:x:x:x::f:245]:443; }
  upstream upstream_3 { server [2001:x:x:x::f:246]:443; }
  
  server {
    listen 443;
    proxy_pass $selected_upstream;
    ssl_preread on;
  }
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,293604,293604#msg-293604



More information about the nginx mailing list