✨ Auto add api prefix for forwarding
This commit is contained in:
parent
f601476e6b
commit
ff8b681eaa
@ -1,12 +1,13 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"git.solsynth.dev/hydrogen/dealer/pkg/internal/directory"
|
"git.solsynth.dev/hydrogen/dealer/pkg/internal/directory"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/gofiber/fiber/v2/middleware/proxy"
|
"github.com/gofiber/fiber/v2/middleware/proxy"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func listExistsService(c *fiber.Ctx) error {
|
func listExistsService(c *fiber.Ctx) error {
|
||||||
@ -32,7 +33,7 @@ func forwardServiceRequest(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
ogUrl := c.Request().URI().String()
|
ogUrl := c.Request().URI().String()
|
||||||
url := c.OriginalURL()
|
url := c.OriginalURL()
|
||||||
url = strings.Replace(url, "/srv/"+serviceType, "", 1)
|
url = strings.Replace(url, "/srv/"+serviceType, "/api", 1)
|
||||||
url = "http://" + *service.HttpAddr + url
|
url = "http://" + *service.HttpAddr + url
|
||||||
|
|
||||||
log.Debug().
|
log.Debug().
|
||||||
|
Loading…
Reference in New Issue
Block a user