Commit 70c5f4f2 authored by gaoshiyao's avatar gaoshiyao

更新路由设置

parent f77c3f1b
{ {
"uuid": "sdfasd", "meshId": "sdfasd",
"url":"https://apaas.wodcloud.com/cigservice/baseservice/fillder/turnover?applyId=0419f3e1-8e16-4e5e-a187-1760364c04e2", "url":"https://apaas.wodcloud.com/cigservice/baseservice/fillder/turnover?applyId=0419f3e1-8e16-4e5e-a187-1760364c04e2",
"method":"GET", "method":"GET",
"params":null "params":null
......
...@@ -34,19 +34,7 @@ func Proxy(c *gin.Context) { ...@@ -34,19 +34,7 @@ func Proxy(c *gin.Context) {
c.Error(err) c.Error(err)
return return
} }
c.Writer.Write(result) 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 { func getProxyURL(req *http.Request) string {
......
...@@ -66,4 +66,7 @@ func getProxyConf() { ...@@ -66,4 +66,7 @@ func getProxyConf() {
} }
json.Unmarshal(b, &config.ProxyConf) json.Unmarshal(b, &config.ProxyConf)
fmt.Println("代理参数:", config.ProxyConf) fmt.Println("代理参数:", config.ProxyConf)
if len(config.ProxyConf.MeshId) > 0 {
*argPrefix += "/" + config.ProxyConf.MeshId
}
} }
...@@ -32,7 +32,7 @@ func Load(middleware ...gin.HandlerFunc) http.Handler { ...@@ -32,7 +32,7 @@ func Load(middleware ...gin.HandlerFunc) http.Handler {
root := e.Group(config.Prefix) root := e.Group(config.Prefix)
{ {
root.GET("/count", handler.GetCount) root.GET("/count", handler.GetCount)
root.Any("/proxy/*action", handler.Proxy) root.Any("/proxy", handler.Proxy)
} }
return e return e
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment