From 2a281415d79877da87f36fd9a43a256e1eb73d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Wed, 21 Aug 2024 17:42:23 +0200 Subject: [PATCH 1/2] geo redirect: Redirect self-node in case of "127.0.0.1" (not MistHost) When catalyst-api is deployed standalone, then MistHost is not "127.0.0.1" and this redirect does not work --- balancer/mist/mist_balancer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From e6c497a707cae7e17e9aa272b96eaaa12f0e1fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Thu, 22 Aug 2024 08:54:42 +0200 Subject: [PATCH 2/2] Fix unit tests --- balancer/mist/mist_balancer_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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,