Compare commits

...

2 Commits

Author SHA1 Message Date
uumas
8af49bcc3e vhost: Support regex matching paths 2025-07-19 20:01:34 +03:00
uumas
cb0817fc54 caddy: indent email by 4 spaces 2025-07-19 20:01:09 +03:00
3 changed files with 11 additions and 5 deletions

View File

@@ -36,7 +36,7 @@
marker: "# {mark} ANSIBLE MANAGED BLOCK general"
block: |
{
email {{ caddy_admin_email }}
email {{ caddy_admin_email }}
}
validate: 'caddy validate --config %s --adapter caddyfile'
backup: true

View File

@@ -378,7 +378,9 @@ argument_specs:
elements: dict
options:
path:
description: Path to match. Only supports full paths for now.
description: >-
Path to match.
If the value begins with ^ and end with $, the value is matched as regex.
type: str
required: true
type:
@@ -565,8 +567,7 @@ argument_specs:
match_headers:
description: >-
Headers to match against.
The value is matched as regex.
^ and $ are implied, so don't add them yourself.
If the value begins with ^ and end with $, the value is matched as regex.
type: dict
required: false
default: {}

View File

@@ -1,7 +1,12 @@
#jinja2: lstrip_blocks: True
{{ vhost_domains | join(' ') }} {
{% for location in _vhost_locations_complete %}
handle {{ location.path }} {
{% if location.path != '' %}
@{{ location.path }} path{{ '_regexp' if location.path.startswith('^') and location.path.endswith('$') else '' }} {{ location.path }}
handle @{{ location.path }} {
{% else %}
handle {
{% endif %}
{% for matcher in location.matchers %}
{% if matcher.name != '' %}
@{{ matcher.name }} {