From cbdfb83e3aab2bc78b517caec608fc180991509e Mon Sep 17 00:00:00 2001 From: Jocelyn Boullier Date: Fri, 19 Jan 2024 18:44:20 +0100 Subject: [PATCH] fix(proxy): record http.host after parsing to avoid Some(..) in the attr (#1527) --- gateway/src/proxy.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gateway/src/proxy.rs b/gateway/src/proxy.rs index 95c5cc0a5a..6724dc906e 100644 --- a/gateway/src/proxy.rs +++ b/gateway/src/proxy.rs @@ -104,7 +104,7 @@ impl UserProxy { task_sender: Sender, mut req: Request, ) -> Result { - 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 @@ -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 {