[#795] Add setting REVERSE_PROXY_INCLUDES to manually add "include" directives in the reverse proxies

This commit is contained in:
Théophile Diot 2023-12-29 16:16:58 +00:00
parent fdb01b3059
commit a5e0ceed3b
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06
2 changed files with 16 additions and 0 deletions

View file

@ -38,6 +38,7 @@ add_header X-Proxy-Cache $upstream_cache_status;
{% set connect_timeout = all[k.replace("URL", "CONNECT_TIMEOUT")] if k.replace("URL", "CONNECT_TIMEOUT") in all else "60s" %}
{% set read_timeout = all[k.replace("URL", "READ_TIMEOUT")] if k.replace("URL", "READ_TIMEOUT") in all else "60s" %}
{% set send_timeout = all[k.replace("URL", "SEND_TIMEOUT")] if k.replace("URL", "SEND_TIMEOUT") in all else "60s" %}
{% set includes = all[k.replace("URL", "INCLUDES")] if k.replace("URL", "INCLUDES") in all else "" %}
location {{ url }} {% raw %}{{% endraw +%}
etag off;
set $backend{{ counter.value }} "{{ host }}";
@ -88,6 +89,11 @@ location {{ url }} {% raw %}{{% endraw +%}
proxy_connect_timeout {{ connect_timeout }};
proxy_read_timeout {{ read_timeout }};
proxy_send_timeout {{ send_timeout }};
{% if includes != "" +%}
{% for include in includes.split(" ") +%}
include {{ include }};
{% endfor +%}
{% endif +%}
{% raw %}}{% endraw %}
{% endif %}
{% set counter.value = counter.value + 1 %}

View file

@ -242,6 +242,16 @@
"regex": "^\\d+(ms?|[shdwMy])$",
"type": "text",
"multiple": "reverse-proxy"
},
"REVERSE_PROXY_INCLUDES": {
"context": "multisite",
"default": "",
"help": "Additional configuration to include in the location block, separated with spaces.",
"id": "reverse-proxy-includes",
"label": "Reverse proxy includes",
"regex": "^(?! )( ?(\\w+)(?!.*\\b\\2\\b))*$",
"type": "text",
"multiple": "reverse-proxy"
}
}
}