X-Node-URL header being added in right place

x-node-url
Neeraj Kashyap 2023-01-11 16:54:21 -08:00
rodzic bfffc77be7
commit f49536a49a
1 zmienionych plików z 1 dodań i 2 usunięć

Wyświetl plik

@ -56,8 +56,6 @@ 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, currentClientAccess)
@ -134,6 +132,7 @@ func lbJSONRPCHandler(w http.ResponseWriter, r *http.Request, blockchain string,
// Overwrite Path so response will be returned to correct place
r.URL.Path = "/"
w.Header().Add("X-Node-URL", node.Endpoint.String())
node.GethReverseProxy.ServeHTTP(w, r)
return
case currentClientAccess.dataSource == "database":