www/caddy: Fix redirect regression (#4390)

www/caddy: Fix redirect regression, always attach http to redir instead of empty default
This commit is contained in:
Monviech
2024-12-10 08:47:27 +01:00
committed by GitHub
parent 751ac7fd5f
commit b4e133bb39
@@ -399,8 +399,13 @@ http://{{ domain }} {
{% if handle.HandleDirective == "reverse_proxy" and handle.ToPath|default("") != "" %}
rewrite * {{ handle.ToPath }}{uri}
{% endif %}
{# http:// is the empty default #}
{% set protocol = 'https://' if handle.HttpTls == "1" else 'h2c://' if handle.HttpTls == "2" else '' -%}
{# http:// is the empty default for reverse_proxy #}
{% set protocol = (
"http://" if handle.HttpTls == "0" and handle.HandleDirective == "redir" else
"https://" if handle.HttpTls == "1" else
"h2c://" if handle.HttpTls == "2" else
''
) %}
{% set formatted_domains = [] -%}
{% for domain in handle.ToDomain.split(',') -%}
{% set is_ipv6 = (':' in domain and domain.count(':') >= 2) -%}