From 65c104a5897722745c2c979c2d683733953cafd7 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 25 Jan 2023 22:44:10 +0530 Subject: [PATCH] add x-amz-id-2 to indicate the node that received the request (#16474) --- cmd/generic-handlers.go | 3 +++ internal/http/headers.go | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/generic-handlers.go b/cmd/generic-handlers.go index a6886a2ad..1a4983790 100644 --- a/cmd/generic-handlers.go +++ b/cmd/generic-handlers.go @@ -551,6 +551,9 @@ func addCustomHeaders(h http.Handler) http.Handler { // part of the log entry, Error response XML and auditing. // Set custom headers such as x-amz-request-id for each request. w.Header().Set(xhttp.AmzRequestID, mustGetRequestID(UTCNow())) + if globalLocalNodeName != "" { + w.Header().Set(xhttp.AmzRequestNodeID, globalLocalNodeName) + } h.ServeHTTP(xhttp.NewResponseRecorder(w), r) }) } diff --git a/internal/http/headers.go b/internal/http/headers.go index 1f2359a57..f40b670fa 100644 --- a/internal/http/headers.go +++ b/internal/http/headers.go @@ -145,7 +145,8 @@ const ( AmzAccessKeyID = "AWSAccessKeyId" // Response request id. - AmzRequestID = "x-amz-request-id" + AmzRequestID = "x-amz-request-id" + AmzRequestNodeID = "x-amz-id-2" // Deployment id. MinioDeploymentID = "x-minio-deployment-id"