diff --git a/docs/proxy.yaml b/docs/proxy.yaml index 9a1ed5966a871db681bd5e4ae237bc4e766ee107..e798a6cb6a141877f54e484f7d0203b45df6f7a1 100644 --- a/docs/proxy.yaml +++ b/docs/proxy.yaml @@ -1,5 +1,5 @@ { - "uuid": "sdfasd", + "meshId": "sdfasd", "url":"https://apaas.wodcloud.com/cigservice/baseservice/fillder/turnover?applyId=0419f3e1-8e16-4e5e-a187-1760364c04e2", "method":"GET", "params":null diff --git a/src/handler/proxyhandler.go b/src/handler/proxyhandler.go index b2d57d67ea6f5ce13f8a82b34a00ca174123c89e..f5ed5a677b7436e0d4fc11f00818e994d08f6210 100644 --- a/src/handler/proxyhandler.go +++ b/src/handler/proxyhandler.go @@ -34,19 +34,7 @@ func Proxy(c *gin.Context) { c.Error(err) return } - c.Writer.Write(result) - // - //req := c.Request - //baseUrl := "http://" + req.Host + req.URL.Path - //req.URL = testutils.ParseURI(getProxyURL(req)) - //req.RequestURI = getRequestURI(req) - //req.Host = req.URL.Host - //logrus.Info("************************************") - //logrus.Info("* 调用地址:", baseUrl) - //logrus.Info("* 转发地址:", req.URL) - //logrus.Info("************************************") - //fwd.ServeHTTP(c.Writer, req) } func getProxyURL(req *http.Request) string { diff --git a/src/main.go b/src/main.go index 79f5aef0a5c8d5052e2f9453a0a7d623f5ec9843..0aab182ea8b48d5004e5fedf3ea57a25a0de174e 100644 --- a/src/main.go +++ b/src/main.go @@ -66,4 +66,7 @@ func getProxyConf() { } json.Unmarshal(b, &config.ProxyConf) fmt.Println("代理参数:", config.ProxyConf) + if len(config.ProxyConf.MeshId) > 0 { + *argPrefix += "/" + config.ProxyConf.MeshId + } } diff --git a/src/router/router.go b/src/router/router.go index 60aee0bc06710caa2c145d6618a9c37eb60a8484..ca78d384916fea03a19852442ab4d1d7fee2f114 100644 --- a/src/router/router.go +++ b/src/router/router.go @@ -32,7 +32,7 @@ func Load(middleware ...gin.HandlerFunc) http.Handler { root := e.Group(config.Prefix) { root.GET("/count", handler.GetCount) - root.Any("/proxy/*action", handler.Proxy) + root.Any("/proxy", handler.Proxy) } return e