diff --git a/src/handler/proxyhandler.go b/src/handler/proxyhandler.go index 6d9f658b6042b182b4e853c95c9c1597c1788fd4..2fb5d4dcc66adfff2f2a6ab2a6523abd5a7d4214 100644 --- a/src/handler/proxyhandler.go +++ b/src/handler/proxyhandler.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "github.com/gin-gonic/gin" + "github.com/spf13/cast" "github.com/vulcand/oxy/forward" "github.com/vulcand/oxy/testutils" "gitlab.wodcloud.com/apaas/apaas-meshproxy/src/model" @@ -173,6 +174,10 @@ func Proxy(c *gin.Context) { c.Request.RequestURI = reqURL.RequestURI() fmt.Println("c.Request-------", c.Request) c.Request.Host = getHost(proxyData.ReqUrl) + //发送服务ID和用户ID + c.Request.Header.Set("applyuserid", proxyData.ApplyUserId) + c.Request.Header.Set("applyserviceid", cast.ToString(proxyData.ServiceId)) + fmt.Println("proxyData.RealUrl-------", proxyData.ReqUrl) forwarder.ServeHTTP(c.Writer, c.Request) }