diff --git a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf index c1fb7f6f7..129bd6906 100644 --- a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf +++ b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf @@ -531,25 +531,27 @@ defaults {% if helpers.exists('OPNsense.HAProxy.frontends') %} {% for frontend in helpers.toList('OPNsense.HAProxy.frontends.frontend') %} -{% if frontend.enabled=='1' %} +{% if frontend.enabled == '1' %} # Frontend: {{frontend.name}} ({{frontend.description}}) frontend {{frontend.name}} -{# # collect ssl certs (if configured) #} -{% if frontend.ssl_certificates|default("") != "" %} -{% set ssl_certs = [] %} -{% for cert in frontend.ssl_certificates.split(",") %} -{% do ssl_certs.append('crt /var/etc/haproxy/ssl/' ~ cert ~ '.pem') %} -{% endfor %} -{% endif %} -{# # advanced ssl options #} -{% if frontend.ssl_customOptions|default("") != "" %} -{# # add a space to separate it from other ssl params #} -{% set ssl_options = frontend.ssl_customOptions ~ ' ' %} +{% if frontend.ssl_enabled == '1' %} +{# # collect ssl certs (if configured) #} +{% if frontend.ssl_certificates|default("") != "" %} +{% set ssl_certs = [] %} +{% for cert in frontend.ssl_certificates.split(",") %} +{% do ssl_certs.append('crt /var/etc/haproxy/ssl/' ~ cert ~ '.pem') %} +{% endfor %} +{% endif %} +{# # advanced ssl options #} +{% if frontend.ssl_customOptions|default("") != "" %} +{# # add a space to separate it from other ssl params #} +{% set ssl_options = frontend.ssl_customOptions ~ ' ' %} +{% endif %} {% endif %} {# # bind/listen configuration #} {% if frontend.bind|default("") != "" %} {% for bind in frontend.bind.split(",") %} - bind {{bind}} name {{bind}} {% if ssl_certs|default("") != "" %}ssl {{ ssl_options }}{{ssl_certs|join(' ')}}{% endif %} + bind {{bind}} name {{bind}} {% if frontend.ssl_enabled == '1' and ssl_certs|default("") != "" %}ssl {{ ssl_options }}{{ssl_certs|join(' ')}} {% endif %} {% endfor %} {% endif %}