diff --git a/backend/internal/nginx.js b/backend/internal/nginx.js index 5f802c00..2478f15c 100644 --- a/backend/internal/nginx.js +++ b/backend/internal/nginx.js @@ -234,6 +234,19 @@ const internalNginx = { // Set the IPv6 setting for the host host.ipv6 = internalNginx.ipv6Enabled(); + + + if ( nice_host_type === 'proxy_host' ) { + let listen_ports = []; + host.domain_names.map( function (domain_name) { + if ( domain_name.indexOf(':') > 0 ){ + listen_ports.push(parseInt(domain_name.substring(domain_name.indexOf(':')+1))); + } + }); + if ( listen_ports.length > 0 ){ + host.listen_ports = listen_ports; + } + } locationsPromise.then(() => { renderEngine diff --git a/backend/templates/_listen.conf b/backend/templates/_listen.conf index 34a808e6..8a58e099 100644 --- a/backend/templates/_listen.conf +++ b/backend/templates/_listen.conf @@ -12,6 +12,9 @@ #listen [::]:443; {% endif %} {% endif %} +{% for listen_port in listen_ports %} + listen listen_port; +{% endfor %} server_name {{ domain_names | join: " " }}; {% if http2_support == 1 or http2_support == true %} http2 on; diff --git a/docker/rootfs/etc/nginx/conf.d/include/proxy.conf b/docker/rootfs/etc/nginx/conf.d/include/proxy.conf index d346c4ef..11c5bb99 100644 --- a/docker/rootfs/etc/nginx/conf.d/include/proxy.conf +++ b/docker/rootfs/etc/nginx/conf.d/include/proxy.conf @@ -1,5 +1,5 @@ add_header X-Served-By $host; -proxy_set_header Host $host; +proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;