From cafc221bfc2579fbbe55fa43ffffaec1f5ee7d11 Mon Sep 17 00:00:00 2001 From: Neeraj Kashyap Date: Tue, 1 Nov 2022 12:29:56 -0700 Subject: [PATCH] Proposed addition of X-Node-URL to response header on node balancer responses. This change has not yet been tested. --- nodes/node_balancer/cmd/nodebalancer/routes.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nodes/node_balancer/cmd/nodebalancer/routes.go b/nodes/node_balancer/cmd/nodebalancer/routes.go index b9929369..56b50444 100644 --- a/nodes/node_balancer/cmd/nodebalancer/routes.go +++ b/nodes/node_balancer/cmd/nodebalancer/routes.go @@ -69,6 +69,8 @@ func lbHandler(w http.ResponseWriter, r *http.Request) { // Save origin path, to use in proxyErrorHandler if node will not response r.Header.Add("X-Origin-Path", r.URL.Path) + w.Header().Add("X-Node-URL", node.Endpoint.String()) + switch { case strings.HasPrefix(r.URL.Path, fmt.Sprintf("/nb/%s/jsonrpc", blockchain)): lbJSONRPCHandler(w, r, blockchain, node, currentClientAccess)