diff --git a/www/caddy/src/opnsense/service/templates/OPNsense/Caddy/Caddyfile b/www/caddy/src/opnsense/service/templates/OPNsense/Caddy/Caddyfile
index 795ba8f62..592f552d5 100644
--- a/www/caddy/src/opnsense/service/templates/OPNsense/Caddy/Caddyfile
+++ b/www/caddy/src/opnsense/service/templates/OPNsense/Caddy/Caddyfile
@@ -354,6 +354,7 @@
# - HttpTlsTrustedCaCerts (string, optional): The config extracted name of a CA certificate.
# - HttpTlsServerName (string, optional): Specifies the server name for the TLS handshake.
# - PassiveHealthFailDuration (integer, optional): Enables passive health checks when set > 0.
+# - HttpVersion (string, optional): Choose HTTP version. Empty (default) is 1.1 and 2.
#}
{% macro reverse_proxy_configuration(handle) %}
{{ handle.HandleType }} {{ handle.HandlePath|default("") }} {
@@ -373,7 +374,7 @@
{% if handle.PassiveHealthFailDuration|default("") %}
fail_duration {{ handle.PassiveHealthFailDuration }}s
{% endif %}
- {% if handle.HttpTls|default("0") == "1" or handle.HttpTlsInsecureSkipVerify|default("0") == "1" or handle.HttpTlsTrustedCaCerts|default("") != "" or handle.HttpTlsServerName|default("") != "" %}
+ {% if handle.HttpTls|default("0") == "1" or handle.HttpTlsInsecureSkipVerify|default("0") == "1" or handle.HttpTlsTrustedCaCerts or handle.HttpTlsServerName or handle.HttpVersion %}
{% if handle.HttpNtlm|default("0") == "1" %}
transport http_ntlm {
{% if handle.HttpTls|default("0") == "1" %}
@@ -391,6 +392,11 @@
}
{% else %}
transport http {
+ {# The model does not allow to set a single number as option directly, so we have to map them. #}
+ {% set version_map = {'http1': 1.1, 'http2': 2, 'http3': 3} %}
+ {% if handle.HttpVersion %}
+ versions {{ version_map[handle.HttpVersion] }}
+ {% endif %}
{% if handle.HttpTls|default("0") == "1" %}
tls
{% endif %}