Feature #2770
closedOverride proxified Host header
Description
Name based virtual host handlers used as backends through lighty's mod_proxy get a better change to properly handle proxified requests by overriding Host
header.
Following an idea posted in Docs_ModProxy, the optional name (that shows up in the generated statistics of mod_status) will be used as value for Host
header.
Additionally, it will turn HTTP/1.0 into HTTP/1.1.
Files
Updated by gstrauss about 8 years ago
- Target version deleted (
1.4.44)
Interesting ideas, but there are some issues.
First, you can not change the request to the backend from HTTP/1.0 to HTTP/1.1 unless mod_proxy is updated to support HTTP/1.1, including being able to accept Transfer-Encoding: chunked in responses, and to de-chunk if the client to lighttpd is HTTP/1.0. Additionally, using HTTP/1.1 is not required for what you are trying to do, which is to send a custom Host header. You can send Host header with HTTP/1.0.
Second, your patch might break existing usage, since current users are not expecting that value to suddenly override the Host header provided by the client. For this patch to be considered, the behavior introduced by your patch would need to be made optional behavior, and disabled by default.
Updated by altblue about 8 years ago
gstrauss wrote:
can not change the request to the backend from HTTP/1.0 to HTTP/1.1
Indeed, that is a stupid overreach, please ignore it, it should not be useful to general audience. IIRC it was driven by some picky backends that did not want to process lighty's proxified requests unless they were marked HTTP/1.1. While sloooowly rebasing a series of ancient patches to 1.4.43, I eagerly submitted this kludge too. My apologies. :-(
patch might break existing usage, since current users are not expecting that value to suddenly override the Host header provided by the client.
For this patch to be considered, the behavior introduced by your patch would need to be made optional behavior, and disabled by default.
I doubt there are users counting on Host
to exist while talking HTTP/1.0 (i.e. instead of using the provided X-Host
- but that's kinda new too, I don't remember it being there), but anyway, I fully agree it's safer to hide it behind a switch. Thanks. :-)
Updated by altblue almost 8 years ago
[mod_proxy] proxy.use-backend-name-as-http-host
Set proxy.use-backend-name-as-http-host = 1
to enable using the optional<name>
that shows up in the generated statistics of mod_status
Updated by gstrauss almost 8 years ago
Thanks for the updated patch.
Would you be averse to me renaming the directive to something shorter, such as "proxy.replace-http-host"?
Should the HTTP Host be forced, even when one is not provided in the original request? (I think it should.)
Updated by altblue almost 8 years ago
gstrauss wrote:
Would you be averse to me renaming the directive to something shorter, such as "proxy.replace-http-host"?
Name it whatever you like, configuration parameter brevity was not my goal, I tried to use something that is as self-explanatory as possible.
Should the HTTP Host be forced, even when one is not provided in the original request? (I think it should.)
The Host header provided in the original request is inconsequential for this feature: backends shall receive the name (as Host header) if it's configured as such. Hence, I don't reckon enforcing to be necessary.
Updated by gstrauss almost 8 years ago
- File lighttpd-1.4.43-mod_proxy-host.patch lighttpd-1.4.43-mod_proxy-host.patch added
- Status changed from New to Patch Pending
- Target version set to 1.4.44
updated patch to follow pattern in recent bugfix 5bf5e1ad and renamed directive to proxy.replace-http-host. Patch has not been tested. Please see if this is acceptable to you.
Updated by gstrauss almost 8 years ago
- Status changed from Patch Pending to Need Feedback
Updated by gstrauss almost 8 years ago
- Status changed from Need Feedback to Fixed
- % Done changed from 0 to 100
Applied in changeset 879ce0b534fc62fac9e5585f49570d5fac3c7e2c.
Also available in: Atom