Skip to content

Commit

Permalink
rollback gateway redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
zgyzgyhero committed Nov 22, 2024
1 parent 5367f8b commit 537ca59
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions platform-gateway/api/support/redirect_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ type RequestHandlerFunc func(request *http.Request, c *gin.Context) error
type ResponseHandlerFunc func(body *[]byte, c *gin.Context) error

func (invoke RedirectInvoke) Do(c *gin.Context) error {
if strings.Contains(invoke.TargetUrl, "/terminal/v1/assets") && c.Request.Method == http.MethodPost {
log.Logger.Info("Use gin redirect url", log.String("url", invoke.TargetUrl))
c.Redirect(http.StatusMovedPermanently, invoke.TargetUrl)
return nil
}

log.Logger.Info(fmt.Sprintf("Redirecting request to downstream system: [Method: %s] [URL: %s] [ContentLength: %d]", c.Request.Method, invoke.TargetUrl, c.Request.ContentLength))
cloneRequest := c.Request.Clone(c.Request.Context()) // deep copy original request

Expand Down

0 comments on commit 537ca59

Please sign in to comment.