[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
personal/stbuehler/tests-path
Glenn Strauss 2021-01-07 08:51:42 -05:00
parent a99550d76c
commit b6892fb242
1 changed files with 4 additions and 0 deletions

View File

@ -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