Skip to content

Commit

Permalink
Merge pull request #2298 from karthik2804/fix_self_outbound
Browse files Browse the repository at this point in the history
set host header on self outbound requests
  • Loading branch information
itowlson authored Mar 12, 2024
2 parents 15a2575 + 891e8d3 commit e82985b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/trigger-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::{
use anyhow::{Context, Result};
use async_trait::async_trait;
use clap::Args;
use http::{uri::Scheme, StatusCode, Uri};
use http::{header::HOST, uri::Scheme, HeaderValue, StatusCode, Uri};
use http_body_util::BodyExt;
use hyper::{
body::{Bytes, Incoming},
Expand Down Expand Up @@ -490,6 +490,9 @@ impl OutboundWasiHttpHandler for HttpRuntimeData {
.parse()
// origin together with the path and query must be a valid URI
.unwrap();
let host = format!("{}:{}", uri.host().unwrap(), uri.port().unwrap());
let headers = request.request.headers_mut();
headers.insert(HOST, HeaderValue::from_str(&host)?);

request.use_tls = uri
.scheme()
Expand Down

0 comments on commit e82985b

Please sign in to comment.