Private
Public Access
2
0

caddy: add site.header and path.strip_prefix
Some checks failed
Publish collection to Galaxy / publish (push) Failing after 42s

This commit is contained in:
2026-03-11 15:40:38 +03:00
parent aa7ef1a41e
commit f03a3c03b8
3 changed files with 12 additions and 7 deletions

View File

@@ -80,7 +80,8 @@ caddy_sites: []
# - id: "" # Mandatory: short id for the site (for site specific directories and files)
# name: "" # Mandatory: canonical domain name
# paths: # Mandatory: targets for the reverse proxy
# - path: "" # Optionnal: path of the request, default "*"
# - path: "*" # Optionnal: path of the request, default "*"
# strip_prefix: false # Optionnal: default "false"
# addrs: # Mandatory: upstreams
# - "" # Mandatory: URL of the upstream, minimum 1 required

View File

@@ -118,7 +118,7 @@
encode gzip zstd
{% for path in site.paths %}
handle {{ path.path | default('*') }} {
handle{% if path.strip_prefix | default(false) %}_path{% endif %} {{ path.path | default('*') }} {
reverse_proxy {
to {{ path.addrs | join(' ') }}
header_up X-Real-IP {remote}
@@ -273,6 +273,7 @@
}
{% endif %}
{% if site.header | default(caddy_sites_defaults.header) %}
header {
Content-Security-Policy "{{ caddy_sites_defaults.header_content_security_policy | combine(site.header_content_security_policy | default({})) | dict2str(sep1=' ', sep2='; ', sep3=';') }}"
Cross-Origin-Embedder-Policy "{{ site.header_cross_origin_embedder_policy | default(caddy_sites_defaults.header_cross_origin_embedder_policy) }}"
@@ -294,6 +295,7 @@
{{ header.name }} "{{ header.value }}"
{% endfor %}
}
{% endif %}
handle_errors 403 {
header X-Blocked "true"

View File

@@ -90,6 +90,8 @@ caddy_global_sites_defaults:
- "Content-Length"
- "Content-Range"
header: true
# Security headers
header_content_security_policy: