caddy: add site.header and path.strip_prefix
Some checks failed
Publish collection to Galaxy / publish (push) Failing after 42s
Some checks failed
Publish collection to Galaxy / publish (push) Failing after 42s
This commit is contained in:
@@ -80,7 +80,8 @@ 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 "*"
|
||||||
|
# strip_prefix: false # Optionnal: default "false"
|
||||||
# addrs: # Mandatory: upstreams
|
# addrs: # Mandatory: upstreams
|
||||||
# - "" # Mandatory: URL of the upstream, minimum 1 required
|
# - "" # Mandatory: URL of the upstream, minimum 1 required
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user