chore: Add pass_request_body option to reverse-proxy.conf

This commit adds the `pass_request_body` option to the `reverse-proxy.conf` file. The option allows enabling or disabling the passing of the request body to the proxied resource. This change provides more flexibility in handling request bodies in the reverse proxy configuration.
This commit is contained in:
Théophile Diot 2024-06-25 17:15:02 +01:00
parent d629f49d10
commit 9a9d739aa2
No known key found for this signature in database
GPG key ID: FA995104A0BA376A
2 changed files with 14 additions and 0 deletions

View file

@ -39,6 +39,7 @@ add_header X-Proxy-Cache $upstream_cache_status;
{% set read_timeout = all[k.replace("HOST", "READ_TIMEOUT")] if k.replace("HOST", "READ_TIMEOUT") in all else "60s" %}
{% set send_timeout = all[k.replace("HOST", "SEND_TIMEOUT")] if k.replace("HOST", "SEND_TIMEOUT") in all else "60s" %}
{% set includes = all[k.replace("HOST", "INCLUDES")] if k.replace("HOST", "INCLUDES") in all else "" %}
{% set pass_request_body = all[k.replace("HOST", "PASS_REQUEST_BODY")] if k.replace("HOST", "PASS_REQUEST_BODY") in all else "" %}
location {{ url }} {% raw %}{{% endraw +%}
etag off;
set $backend{{ counter.value }} "{{ host }}";
@ -94,6 +95,9 @@ location {{ url }} {% raw %}{{% endraw +%}
include {{ include }};
{% endfor +%}
{% endif +%}
{% if pass_request_body == "no" +%}
proxy_pass_request_body off;
{% endif +%}
{% raw %}}{% endraw %}
{% endif %}
{% set counter.value = counter.value + 1 %}

View file

@ -172,6 +172,16 @@
"type": "text",
"multiple": "reverse-proxy"
},
"REVERSE_PROXY_PASS_REQUEST_BODY": {
"context": "multisite",
"default": "yes",
"help": "Enable or disable passing the request body to the proxied resource.",
"id": "reverse-proxy-pass-request-body",
"label": "Reverse proxy pass request body",
"regex": "^(yes|no)$",
"type": "check",
"multiple": "reverse-proxy"
},
"USE_PROXY_CACHE": {
"context": "multisite",
"default": "no",