Skip to content

Commit 3492480

Browse files
committed
tolerate missing host header in h2 proxy
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1927036 13f79535-47bb-0310-9956-ffa450edef68
1 parent d76573e commit 3492480

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

modules/http2/h2_proxy_session.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,18 @@ static apr_status_t open_stream(h2_proxy_session *session, const char *url,
850850
dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
851851
if (dconf->preserve_host) {
852852
authority = orig_host;
853+
if (!authority) {
854+
/* Duplicate mod_proxy behaviour if ProxyPreserveHost is
855+
* used but an "HTTP/0.9" request is received without a
856+
* Host: header */
857+
authority = r->server->server_hostname;
858+
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(10511)
859+
"HTTP/0.9 request (with no host line) "
860+
"on incoming request and preserve host set "
861+
"forcing hostname to be %s for uri %s",
862+
authority, r->uri);
863+
apr_table_setn(r->headers_in, "Host", authority);
864+
}
853865
}
854866
else {
855867
authority = puri.hostname;

0 commit comments

Comments
 (0)