From b6892fb2421ba46d7d56fb98073dd2eb341a9f64 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Thu, 7 Jan 2021 08:51:42 -0500 Subject: [PATCH] [mod_extforward] fix extforward.headers defaults (fixes #3051) (thx glen) Regression in lighttpd 1.4.56 - 1.4.58 when extforward.headers is not set in lighttpd.conf. Workaround: extforward.headers = ("X-Forwarded-For") (or appropriate value depending on header sent by upstream proxy) x-ref: "mod_extforward regression 1.4.56" https://redmine.lighttpd.net/issues/3051 --- src/mod_extforward.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod_extforward.c b/src/mod_extforward.c index e2f1843a..534146c9 100644 --- a/src/mod_extforward.c +++ b/src/mod_extforward.c @@ -405,6 +405,10 @@ SETDEFAULTS_FUNC(mod_extforward_set_defaults) { p->defaults.headers = p->default_headers = array_init(2); array_insert_value(p->default_headers,CONST_STR_LEN("X-Forwarded-For")); array_insert_value(p->default_headers,CONST_STR_LEN("Forwarded-For")); + for (uint32_t i = 0; i < p->default_headers->used; ++i) { + data_string * const ds = (data_string *)p->default_headers->data[i]; + ds->ext = http_header_hkey_get(CONST_BUF_LEN(&ds->value)); + } } /* attempt to warn if mod_extforward is not last module loaded to hook