Skip to content

Commit c3763bd

Browse files
committed
Avoid redefining x-request-id header
1 parent 6586f97 commit c3763bd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

ui/src/server_axum.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ pub(crate) async fn serve(config: Config) {
134134
let x_request_id = HeaderName::from_static("x-request-id");
135135

136136
// Basic access logging
137-
app = app.layer(
137+
app = app.layer({
138+
let x_request_id = x_request_id.clone();
138139
TraceLayer::new_for_http().make_span_with(move |req: &Request<_>| {
139140
const REQUEST_ID: &str = "request_id";
140141

@@ -152,10 +153,8 @@ pub(crate) async fn serve(config: Config) {
152153
}
153154

154155
span
155-
}),
156-
);
157-
158-
let x_request_id = HeaderName::from_static("x-request-id");
156+
})
157+
});
159158

160159
// propagate `x-request-id` headers from request to response
161160
app = app.layer(PropagateRequestIdLayer::new(x_request_id.clone()));

0 commit comments

Comments
 (0)