diff --git a/pkg/internal/server/api/directory.go b/pkg/internal/server/api/directory.go index 00205be..2eb245a 100644 --- a/pkg/internal/server/api/directory.go +++ b/pkg/internal/server/api/directory.go @@ -25,8 +25,9 @@ func listExistsService(c *fiber.Ctx) error { func forwardServiceRequest(c *fiber.Ctx) error { serviceType := c.Params("service") + ogKeyword := serviceType - aliasingMap := viper.GetStringMapString("services.alias") + aliasingMap := viper.GetStringMapString("services.aliases") if val, ok := aliasingMap[serviceType]; ok { serviceType = val } @@ -39,11 +40,7 @@ func forwardServiceRequest(c *fiber.Ctx) error { ogUrl := c.Request().URI().String() url := c.OriginalURL() - prevUrl := url - url = strings.Replace(url, "/srv/"+serviceType, "/api", 1) - if prevUrl == url { - url = strings.Replace(url, "/cgi/"+serviceType, "/api", 1) - } + url = strings.Replace(url, "/cgi/"+ogKeyword, "/api", 1) url = "http://" + *service.HttpAddr + url log.Debug(). diff --git a/pkg/internal/server/api/index.go b/pkg/internal/server/api/index.go index d293cdd..f725093 100644 --- a/pkg/internal/server/api/index.go +++ b/pkg/internal/server/api/index.go @@ -16,7 +16,6 @@ func MapAPIs(app *fiber.App) { } app.All("/cgi/:service/*", forwardServiceRequest) - app.All("/srv/:service/*", forwardServiceRequest) api := app.Group("/api").Name("API") { diff --git a/settings.toml b/settings.toml index 474475d..faffe90 100644 --- a/settings.toml +++ b/settings.toml @@ -37,5 +37,5 @@ access_token_duration = 300 refresh_token_duration = 2592000 [services] -alias = { id = "auth", uc = "files", co = "interactive", im = "messagings" } +aliases = { id = "auth", uc = "files", co = "interactive", im = "messaging" }