aboutsummaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorteutat3s <10206665+teutat3s@users.noreply.github.com>2023-03-13 13:59:42 +0100
committerteutat3s <10206665+teutat3s@users.noreply.github.com>2023-03-13 13:59:42 +0100
commit8ad6efb338bd20036614dd0697edb328aed1e7fd (patch)
treebef0b3bb43be503b5459e610f782e658562cf3bf /src/web
parent3b498c7c4725ab83edd5fdeba65b32ae6bdc3e66 (diff)
parent3325928c1327eb35201723013388ede2399f2350 (diff)
downloadgarage-8ad6efb338bd20036614dd0697edb328aed1e7fd.tar.gz
garage-8ad6efb338bd20036614dd0697edb328aed1e7fd.zip
Merge branch 'main' into pnet_datalink-0.33.0
Diffstat (limited to 'src/web')
-rw-r--r--src/web/web_server.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/web/web_server.rs b/src/web/web_server.rs
index 5719da54..0c7edf23 100644
--- a/src/web/web_server.rs
+++ b/src/web/web_server.rs
@@ -29,6 +29,7 @@ use garage_model::garage::Garage;
use garage_table::*;
use garage_util::error::Error as GarageError;
+use garage_util::forwarded_headers;
use garage_util::metrics::{gen_trace_id, RecordDuration};
struct WebMetrics {
@@ -104,7 +105,19 @@ impl WebServer {
req: Request<Body>,
addr: SocketAddr,
) -> Result<Response<Body>, Infallible> {
- info!("{} {} {}", addr, req.method(), req.uri());
+ if let Ok(forwarded_for_ip_addr) =
+ forwarded_headers::handle_forwarded_for_headers(&req.headers())
+ {
+ info!(
+ "{} (via {}) {} {}",
+ forwarded_for_ip_addr,
+ addr,
+ req.method(),
+ req.uri()
+ );
+ } else {
+ info!("{} {} {}", addr, req.method(), req.uri());
+ }
// Lots of instrumentation
let tracer = opentelemetry::global::tracer("garage");