From 79b04eefa7dcc268c33f610ad3c8faafae3a454b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Thu, 22 Aug 2024 09:03:34 +0200 Subject: [PATCH] geo redirect: Redirect self-node in case of "127.0.0.1" (not MistHost) (#1364) --- balancer/mist/mist_balancer.go | 2 +- balancer/mist/mist_balancer_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/balancer/mist/mist_balancer.go b/balancer/mist/mist_balancer.go index 044db7c8..1e5746bf 100644 --- a/balancer/mist/mist_balancer.go +++ b/balancer/mist/mist_balancer.go @@ -421,7 +421,7 @@ func (b *MistBalancer) MistUtilLoadBalance(ctx context.Context, stream, lat, lon return "", err } // Special case: rewrite our local node to our public node url - if str == b.config.MistHost { + if str == "127.0.0.1" { str = b.config.NodeName } return str, nil diff --git a/balancer/mist/mist_balancer_test.go b/balancer/mist/mist_balancer_test.go index 3b663a8c..ae052f7f 100644 --- a/balancer/mist/mist_balancer_test.go +++ b/balancer/mist/mist_balancer_test.go @@ -26,7 +26,7 @@ func start(t *testing.T) (*MistBalancer, *mockMistUtilLoad) { b := &MistBalancer{ config: &balancer.Config{ - MistHost: u.Hostname(), + MistHost: "127.0.0.1", MistPort: port, OwnRegion: "fra", OwnRegionTagAdjust: 1000,