From ff8b681eaac879fb132018ce044bd2dd3ab8eeff Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 16 Jul 2024 18:07:48 +0800 Subject: [PATCH] :sparkles: Auto add api prefix for forwarding --- pkg/internal/server/api/directory.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/internal/server/api/directory.go b/pkg/internal/server/api/directory.go index 7435327..292d9ba 100644 --- a/pkg/internal/server/api/directory.go +++ b/pkg/internal/server/api/directory.go @@ -1,12 +1,13 @@ package api import ( + "strings" + "git.solsynth.dev/hydrogen/dealer/pkg/internal/directory" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/proxy" "github.com/rs/zerolog/log" "github.com/samber/lo" - "strings" ) func listExistsService(c *fiber.Ctx) error { @@ -32,7 +33,7 @@ func forwardServiceRequest(c *fiber.Ctx) error { ogUrl := c.Request().URI().String() url := c.OriginalURL() - url = strings.Replace(url, "/srv/"+serviceType, "", 1) + url = strings.Replace(url, "/srv/"+serviceType, "/api", 1) url = "http://" + *service.HttpAddr + url log.Debug().