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

@@ -77,12 +77,13 @@ caddy_crs_plugins:
# Sites # Sites
caddy_sites: [] caddy_sites: []
# - id: "" # Mandatory: short id for the site (for site specific directories and files) # - id: "" # Mandatory: short id for the site (for site specific directories and files)
# name: "" # Mandatory: canonical domain name # name: "" # Mandatory: canonical domain name
# paths: # Mandatory: targets for the reverse proxy # paths: # Mandatory: targets for the reverse proxy
# - path: "" # Optionnal: path of the request, default "*" # - path: "*" # Optionnal: path of the request, default "*"
# addrs: # Mandatory: upstreams # strip_prefix: false # Optionnal: default "false"
# - "" # Mandatory: URL of the upstream, minimum 1 required # addrs: # Mandatory: upstreams
# - "" # Mandatory: URL of the upstream, minimum 1 required
# For overriding default global parameters. Will be merged with # For overriding default global parameters. Will be merged with

View File

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

View File

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