Skip to content

Commit 11023c0

Browse files
authored
outbound-http: Remove host header with http2 (#3194)
The HTTP/2 spec allows the host header to be set as long as it matches :authority, but some servers seem to have trouble accepting this reality: hyperium/hyper#3298 Signed-off-by: Lann Martin <lann.martin@fermyon.com>
1 parent cb47654 commit 11023c0

File tree

1 file changed

+5
-1
lines changed
  • crates/factor-outbound-http/src

1 file changed

+5
-1
lines changed

crates/factor-outbound-http/src/wasi.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,11 @@ async fn send_request_handler(
330330
(sender, worker, is_http2)
331331
};
332332

333-
if !is_http2 {
333+
if is_http2 {
334+
// Some servers (looking at you nginx) don't like a host header even though
335+
// http/2 allows it: https://github.com/hyperium/hyper/issues/3298
336+
request.headers_mut().remove(HOST);
337+
} else {
334338
// at this point, the request contains the scheme and the authority, but
335339
// the http packet should only include those if addressing a proxy, so
336340
// remove them here, since SendRequest::send_request does not do it for us

0 commit comments

Comments
 (0)