diff --git a/roles/caddy/templates/etc/caddy/conf.d/vhost.j2 b/roles/caddy/templates/etc/caddy/conf.d/vhost.j2 index 141af67..3dea00e 100644 --- a/roles/caddy/templates/etc/caddy/conf.d/vhost.j2 +++ b/roles/caddy/templates/etc/caddy/conf.d/vhost.j2 @@ -7,11 +7,29 @@ {% set has_wordpress = item.has_wordpress | default(false) %} {% set needs_php = item.needs_php | default(false) %} {% set has_gitea = item.has_gitea | default(false) %} +{% set static_site = item.static_site | default(false) %} + +{% if domain_aliases %} +{# domain_aliases is a string, so we split on space #} +{% for domain in domain_aliases | split (' ') %} +{{ domain }} { + redir https://{{domain_name}}{uri} +} +{% endfor %} +{% endif %} {{ domain_name }} { {% if has_gitea %} reverse_proxy :3000 {% endif %} + {% if static_site -%} + root * {{ item.document_root }} + + encode zstd gzip + + file_server + {% endif %} + import security-headers }