From fdaf040f9f5b61199cb443b9ffe4c723d14cb313 Mon Sep 17 00:00:00 2001 From: "leitao.zhang" Date: Mon, 28 Dec 2020 10:35:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=E7=94=B3=E8=AF=B7=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7ID=E5=92=8C=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E7=9A=84=E6=9C=8D=E5=8A=A1ID=E4=BC=A0=E8=BF=87=E7=BB=99?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E7=9A=84=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/handler/proxyhandler.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/handler/proxyhandler.go b/src/handler/proxyhandler.go index 6d9f658..2fb5d4d 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) } -- 2.26.0