vhost: Add option to find and replace headers in reverse proxy
This commit is contained in:
@@ -6,6 +6,7 @@ vhost_web_server: caddy
|
|||||||
|
|
||||||
vhost_locations: []
|
vhost_locations: []
|
||||||
vhost_headers: {}
|
vhost_headers: {}
|
||||||
|
vhost_find_replace_headers: []
|
||||||
vhost_delete_headers: []
|
vhost_delete_headers: []
|
||||||
|
|
||||||
vhost_basicauth: false
|
vhost_basicauth: false
|
||||||
|
|||||||
@@ -46,6 +46,25 @@ argument_specs:
|
|||||||
type: dict
|
type: dict
|
||||||
required: false
|
required: false
|
||||||
default: {}
|
default: {}
|
||||||
|
vhost_find_replace_headers:
|
||||||
|
description: Response headers to find and replace
|
||||||
|
type: list
|
||||||
|
elements: dict
|
||||||
|
required: false
|
||||||
|
default: []
|
||||||
|
options:
|
||||||
|
header:
|
||||||
|
description: Header to modify
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
find:
|
||||||
|
description: Header content to find
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
replace:
|
||||||
|
description: Content to replace matching headers with
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
vhost_delete_headers:
|
vhost_delete_headers:
|
||||||
description: List of reponse headers to delete
|
description: List of reponse headers to delete
|
||||||
type: list
|
type: list
|
||||||
@@ -242,6 +261,25 @@ argument_specs:
|
|||||||
type: dict
|
type: dict
|
||||||
required: false
|
required: false
|
||||||
default: "{{ vhost_headers }}"
|
default: "{{ vhost_headers }}"
|
||||||
|
find_replace_headers:
|
||||||
|
description: Response headers to find and replace
|
||||||
|
type: list
|
||||||
|
elements: dict
|
||||||
|
required: false
|
||||||
|
default: "{{ vhost_find_replace_headers }}"
|
||||||
|
options:
|
||||||
|
header:
|
||||||
|
description: Header to modify
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
find:
|
||||||
|
description: Header content to find
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
replace:
|
||||||
|
description: Content to replace matching headers with
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
delete_headers:
|
delete_headers:
|
||||||
description: List of response headers to delete
|
description: List of response headers to delete
|
||||||
type: list
|
type: list
|
||||||
@@ -414,6 +452,25 @@ argument_specs:
|
|||||||
type: dict
|
type: dict
|
||||||
required: false
|
required: false
|
||||||
default: "{{ vhost_headers }}"
|
default: "{{ vhost_headers }}"
|
||||||
|
find_replace_headers:
|
||||||
|
description: Response headers to find and replace
|
||||||
|
type: list
|
||||||
|
elements: dict
|
||||||
|
required: false
|
||||||
|
default: "{{ vhost_find_replace_headers }}"
|
||||||
|
options:
|
||||||
|
header:
|
||||||
|
description: Header to modify
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
find:
|
||||||
|
description: Header content to find
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
replace:
|
||||||
|
description: Content to replace matching headers with
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
delete_headers:
|
delete_headers:
|
||||||
description: List of response headers to delete
|
description: List of response headers to delete
|
||||||
type: list
|
type: list
|
||||||
@@ -610,6 +667,24 @@ argument_specs:
|
|||||||
description: Dict of response headers and their values
|
description: Dict of response headers and their values
|
||||||
type: dict
|
type: dict
|
||||||
required: false
|
required: false
|
||||||
|
find_replace_headers:
|
||||||
|
description: Response headers to find and replace
|
||||||
|
type: list
|
||||||
|
elements: dict
|
||||||
|
required: false
|
||||||
|
options:
|
||||||
|
header:
|
||||||
|
description: Header to modify
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
find:
|
||||||
|
description: Header content to find
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
|
replace:
|
||||||
|
description: Content to replace matching headers with
|
||||||
|
type: str
|
||||||
|
required: true
|
||||||
delete_headers:
|
delete_headers:
|
||||||
description: List of response headers to delete
|
description: List of response headers to delete
|
||||||
type: list
|
type: list
|
||||||
|
|||||||
@@ -22,6 +22,12 @@
|
|||||||
{% for header in matcher.delete_headers %}
|
{% for header in matcher.delete_headers %}
|
||||||
header -{{ header }}
|
header -{{ header }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% for header in matcher.find_replace_headers %}
|
||||||
|
header {
|
||||||
|
{{ header.header }} `^{{ header.find }}$` `{{ header.replace }}`
|
||||||
|
defer
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
{% for header in matcher.headers | dict2items %}
|
{% for header in matcher.headers | dict2items %}
|
||||||
header {{ header.key }} `{{ header.value }}`
|
header {{ header.key }} `{{ header.value }}`
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ _vhost_matchers: >-
|
|||||||
_vhost_location_defaults:
|
_vhost_location_defaults:
|
||||||
type: "{{ vhost_type }}"
|
type: "{{ vhost_type }}"
|
||||||
headers: "{{ vhost_headers }}"
|
headers: "{{ vhost_headers }}"
|
||||||
|
find_replace_headers: "{{ vhost_find_replace_headers }}"
|
||||||
delete_headers: "{{ vhost_delete_headers }}"
|
delete_headers: "{{ vhost_delete_headers }}"
|
||||||
|
|
||||||
basicauth: "{{ vhost_basicauth }}"
|
basicauth: "{{ vhost_basicauth }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user