add support to add headers to all vhosts
This commit is contained in:
parent
be5b2f4bae
commit
b926014bdf
3 changed files with 10 additions and 2 deletions
|
|
@ -33,6 +33,9 @@ php: False
|
||||||
# dict of ips to accept "X-Forwarded-~" from
|
# dict of ips to accept "X-Forwarded-~" from
|
||||||
real_ip_from: {"127.0.0.1": {}, "::1": {}}
|
real_ip_from: {"127.0.0.1": {}, "::1": {}}
|
||||||
|
|
||||||
|
# array of headers to add on *all* vhosts
|
||||||
|
add_headers: []
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**upstreamconfig**:
|
**upstreamconfig**:
|
||||||
|
|
@ -72,6 +75,9 @@ custom: []
|
||||||
|
|
||||||
# array of locations, see below
|
# array of locations, see below
|
||||||
locations: [*locationconfig*, .. ]
|
locations: [*locationconfig*, .. ]
|
||||||
|
|
||||||
|
# array of headers to add on this vhost
|
||||||
|
add_headers: []
|
||||||
```
|
```
|
||||||
|
|
||||||
**locationconfig**:
|
**locationconfig**:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
|
add_headers: []
|
||||||
real_ip_from:
|
real_ip_from:
|
||||||
"127.0.0.1": {}
|
"127.0.0.1": {}
|
||||||
"::1": {}
|
"::1": {}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
{% set vhost = item.value %}
|
{% set vhost = item.value %}
|
||||||
{% set vhost_name = item.key %}
|
{% set vhost_name = item.key %}
|
||||||
{% set vhost_listen = vhost.listen|default({}) %}
|
{% set vhost_listen = vhost.listen|default({}) %}
|
||||||
|
{% set vhost_headers = nginx.add_headers|default({})|combine(vhost.add_headers|default({})) %}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
{% if vhost.servername|default([])|length > 0 %}
|
{% if vhost.servername|default([])|length > 0 %}
|
||||||
|
|
@ -17,8 +18,8 @@ server {
|
||||||
listen [::]:{{ vhost_listen.nossl_port|default(80) }} {% if vhost.default_server|default(False) %}default_server{% endif %};
|
listen [::]:{{ vhost_listen.nossl_port|default(80) }} {% if vhost.default_server|default(False) %}default_server{% endif %};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% for header in vhost.add_headers|default([]) %}
|
{% for header in vhost_headers if header %}
|
||||||
add_header {{ header }} "{{ vhost.add_headers[header] }}";
|
add_header {{ header }} "{{ vhost_headers[header] }}";
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% for c in vhost.custom|default([]) %}
|
{% for c in vhost.custom|default([]) %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue