[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
This commit is contained in:
Glenn Strauss 2017-03-23 12:44:57 -04:00
parent 37261bbd7e
commit 4115266792
1 changed files with 1 additions and 0 deletions

View File

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