Skip to content

Commit

Permalink
fix(proxy): record http.host after parsing to avoid Some(..) in the a…
Browse files Browse the repository at this point in the history
…ttr (#1527)
  • Loading branch information
Kazy authored and jonaro00 committed Jan 24, 2024
1 parent 178f617 commit cbdfb83
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gateway/src/proxy.rs
Expand Up @@ -104,7 +104,7 @@ impl UserProxy {
task_sender: Sender<BoxedTask>,
mut req: Request<Body>,
) -> Result<Response, Error> {
let span = debug_span!("proxy", http.method = %req.method(), http.host = ?req.headers().get("Host"), http.uri = %req.uri(), http.status_code = field::Empty, shuttle.project.name = field::Empty);
let span = debug_span!("proxy", http.method = %req.method(), http.host = field::Empty, http.uri = %req.uri(), http.status_code = field::Empty, shuttle.project.name = field::Empty);
trace!(?req, "serving proxy request");

let fqdn = req
Expand All @@ -113,6 +113,8 @@ impl UserProxy {
.map(|host| fqdn!(host.hostname()))
.ok_or_else(|| Error::from_kind(ErrorKind::BadHost))?;

span.record("http.host", fqdn.to_string());

let project_name = if fqdn.is_subdomain_of(&self.public)
&& fqdn.depth() - self.public.depth() == 1
{
Expand Down

0 comments on commit cbdfb83

Please sign in to comment.