bw - add REVERSE_PROXY_CUSTOM_HOST setting

This commit is contained in:
florian 2024-02-27 22:27:50 +01:00
parent ad96dc0fa0
commit cbb32e7688
No known key found for this signature in database
GPG key ID: 93EE47CC3D061500
2 changed files with 11 additions and 2 deletions

View file

@ -43,12 +43,12 @@ location {{ url }} {% raw %}{{% endraw +%}
etag off;
set $backend{{ counter.value }} "{{ host }}";
proxy_pass $backend{{ counter.value }};
proxy_set_header Host $host;
proxy_set_header Host {% if REVERSE_PROXY_CUSTOM_HOST != "" %}"{{ REVERSE_PROXY_CUSTOM_HOST }}"{% else %}$host{% endif %};
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Host {% if REVERSE_PROXY_CUSTOM_HOST != "" %}"{{ REVERSE_PROXY_CUSTOM_HOST }}"{% else %}$http_host{% endif %};
{% if url.startswith("/") +%}
proxy_set_header X-Forwarded-Prefix "{{ url }}";
{% endif %}

View file

@ -252,6 +252,15 @@
"regex": "^(?! )( ?(\\w+)(?!.*\\b\\2\\b))*$",
"type": "text",
"multiple": "reverse-proxy"
},
"REVERSE_PROXY_CUSTOM_HOST": {
"context": "multisite",
"default": "",
"help": "Override Host header sent to upstream server.",
"id": "reverse-proxy-custom-host",
"label": "Reverse proxy custom host",
"regex": "^.*$",
"type": "text"
}
}
}