[mod_proxy] set X-Forwarded-Host (fixes #418)

lighttpd appends the request "Host" to the non-standard header "X-Host"
when acting as a reverse proxy.  This patch additionally appends "Host"
to the non-standard header "X-Forwarded-Host" to match the convention in
some other web servers

x-ref:
  "mod_proxy should send the X-Forwarded-Host header to the proxied server"
  https://redmine.lighttpd.net/issues/418
personal/stbuehler/mod-csrf
Glenn Strauss 6 years ago
parent 37261bbd7e
commit 4115266792
  1. 1
      src/mod_proxy.c

@ -665,6 +665,7 @@ static int proxy_create_env(server *srv, handler_ctx *hctx) {
* which is NULL if it is not set */
if (!buffer_string_is_empty(con->request.http_host)) {
proxy_set_header(con, "X-Host", con->request.http_host->ptr);
proxy_set_header(con, "X-Forwarded-Host", con->request.http_host->ptr);
}
proxy_set_header(con, "X-Forwarded-Proto", con->uri.scheme->ptr);

Loading…
Cancel
Save