diff --git a/roles/service-nginx-firmware/templates/firmware_vhost.conf.j2 b/roles/service-nginx-firmware/templates/firmware_vhost.conf.j2 index 1511aab..cc9a29e 100644 --- a/roles/service-nginx-firmware/templates/firmware_vhost.conf.j2 +++ b/roles/service-nginx-firmware/templates/firmware_vhost.conf.j2 @@ -41,7 +41,11 @@ server { server { listen 80; listen [::]:80; +{% if mesh.http_domain_external is defined %} server_name firmware.{{ mesh.http_domain_external }} firmware.{{ mesh.http_domain_internal }}; +{% else %} + server_name firmware.{{ mesh.http_domain_internal }}; +{% endif %} charset utf-8; server_tokens off; @@ -58,7 +62,11 @@ server { server { listen 443 ssl; listen [::]:443 ssl; +{% if mesh.http_domain_external is defined %} server_name firmware.{{ mesh.http_domain_external }} firmware.{{ mesh.http_domain_internal }}; +{% else %} + server_name firmware.{{ mesh.http_domain_internal }}; +{% endif %} add_header 'Access-Control-Allow-Origin' '*'; diff --git a/roles/service-nginx-meshviewer/templates/meshviewer_vhost.conf.j2 b/roles/service-nginx-meshviewer/templates/meshviewer_vhost.conf.j2 index d21a387..0f144e3 100644 --- a/roles/service-nginx-meshviewer/templates/meshviewer_vhost.conf.j2 +++ b/roles/service-nginx-meshviewer/templates/meshviewer_vhost.conf.j2 @@ -58,7 +58,11 @@ server { server { listen 80; listen [::]:80; +{% if mesh.http_domain_external is defined %} server_name {{ http_meshviewer_prefix }}.{{ mesh.http_domain_external }} {{ http_meshviewer_prefix }}.{{ mesh.http_domain_internal }}; +{% else %} + server_name {{ http_meshviewer_prefix }}.{{ mesh.http_domain_internal }}; +{% endif %} return 301 https://{{ http_meshviewer_external }}$request_uri; include /etc/nginx/snippets/letsencrypt-acme-challenge.conf; @@ -67,7 +71,11 @@ server { server { listen 443 ssl; listen [::]:443 ssl; - server_name {{ http_meshviewer_prefix }}.{{ mesh.http_domain_internal }} {{ http_meshviewer_prefix }}.{{ mesh.http_domain_external }}; +{% if mesh.http_domain_external is defined %} + server_name {{ http_meshviewer_prefix }}.{{ mesh.http_domain_external }} {{ http_meshviewer_prefix }}.{{ mesh.http_domain_internal }}; +{% else %} + server_name {{ http_meshviewer_prefix }}.{{ mesh.http_domain_internal }}; +{% endif %} return 301 https://{{ http_meshviewer_external }}$request_uri; include /etc/nginx/snippets/letsencrypt-acme-challenge.conf;