From 03958d170b845c3502425b5a798b7ff09f54a6cf Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 8 Aug 2021 22:24:10 +0200 Subject: [PATCH] outpost/proxy: fix string substitution for internal Signed-off-by: Jens Langhammer --- internal/outpost/proxy/api_bundle.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/outpost/proxy/api_bundle.go b/internal/outpost/proxy/api_bundle.go index 34d3f3050..bc0db6e5e 100644 --- a/internal/outpost/proxy/api_bundle.go +++ b/internal/outpost/proxy/api_bundle.go @@ -36,9 +36,12 @@ func intToPointer(i int) *int { } func (pb *providerBundle) replaceLocal(url string) string { - f := strings.ReplaceAll(url, "localhost:8000", pb.s.ak.Client.GetConfig().Host) - f = strings.ReplaceAll(f, "http", pb.s.ak.Client.GetConfig().Scheme) - return f + if strings.Contains(url, "localhost:8000") { + f := strings.ReplaceAll(url, "localhost:8000", pb.s.ak.Client.GetConfig().Host) + f = strings.ReplaceAll(f, "http", pb.s.ak.Client.GetConfig().Scheme) + return f + } + return url } func (pb *providerBundle) prepareOpts(provider api.ProxyOutpostConfig) *options.Options {