From 2e403c6ebcd8b055d3d933ba2744f98b930efd58 Mon Sep 17 00:00:00 2001 From: bunkerity Date: Thu, 2 Sep 2021 10:34:58 +0200 Subject: [PATCH] config - add CUSTOM_HEADER --- confs/site/custom-headers.conf | 5 +++++ confs/site/server.conf | 3 +++ docs/environment_variables.md | 6 ++++++ settings.json | 17 +++++++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 confs/site/custom-headers.conf diff --git a/confs/site/custom-headers.conf b/confs/site/custom-headers.conf new file mode 100644 index 0000000..e2e2bf9 --- /dev/null +++ b/confs/site/custom-headers.conf @@ -0,0 +1,5 @@ +{% for k, v in all.items() +%} + {% if k.startswith("CUSTOM_HEADER") and v != "" +%} +more_set_header "{{ v }}"; + {% endif %} +{% endfor %} diff --git a/confs/site/server.conf b/confs/site/server.conf index 9292b2c..6405404 100644 --- a/confs/site/server.conf +++ b/confs/site/server.conf @@ -180,6 +180,9 @@ server { include {{ NGINX_PREFIX }}redirect-to.conf; {% endif %} + # custom headers + include {{ NGINX_PREFIX }}custom-headers.conf; + # reverse proxy {% if USE_REVERSE_PROXY == "yes" +%} include {{ NGINX_PREFIX }}reverse-proxy.conf; diff --git a/docs/environment_variables.md b/docs/environment_variables.md index 2c736d7..576e516 100644 --- a/docs/environment_variables.md +++ b/docs/environment_variables.md @@ -123,6 +123,12 @@ Default value : *no* Context : *global*, *multisite* When set to yes and `REDIRECT_TO` is set it will append the requested path to the redirection (e.g., https://example.com/something redirects to https://www.example.com/something). +`CUSTOM_HEADER` +Values : *\* +Default value : +Context : *global*, *multisite* +Add custom HTTP header of your choice to clients. You can add multiple headers by appending a number as a suffix of the environment variable : `CUSTOM_HEADER_1`, `CUSTOM_HEADER_2`, `CUSTOM_HEADER_3`, ... + ### Information leak `SERVER_TOKENS` diff --git a/settings.json b/settings.json index 96bc25a..6a73cbd 100644 --- a/settings.json +++ b/settings.json @@ -775,6 +775,23 @@ "label": "Content security policy", "regex": "^([\\S ]*)$", "type": "text" + }, + { + "id": "custom-headers", + "label": "Custom headers", + "params" : [ + { + "context": "multisite", + "default": "", + "env": "CUSTOM_HEADER", + "id": "custom-headers", + "label": "Custom header", + "multiple": "Custom headers", + "regex": "^([\\S ]*)$", + "type": "text" + } + ], + "type": "multiple" } ] },