1
This commit is contained in:
parent
124454f768
commit
3cb84aeff3
@ -7,7 +7,6 @@ import (
|
||||
"io/ioutil"
|
||||
"jccommon"
|
||||
"main/service"
|
||||
"main/mt"
|
||||
"net/http"
|
||||
net_url "net/url"
|
||||
"q5"
|
||||
@ -41,7 +40,8 @@ func CaForward(c *gin.Context) {
|
||||
costTime := q5.GetTickCount() - beginTick
|
||||
service.SApiForward.UpdateCostTime(costTime)
|
||||
}()
|
||||
newUrl := mt.Table.Config.GetById(0).GetRedirectUrl() + c.Request.URL.Path[5:]
|
||||
downStreamUrl, downStreamHost := service.SApiForward.GetDownStreamHost();
|
||||
newUrl := downStreamUrl + c.Request.URL.Path[5:]
|
||||
if !q5.StrContains(newUrl, "?") {
|
||||
newUrl = newUrl + "?"
|
||||
}
|
||||
@ -105,6 +105,9 @@ func CaForward(c *gin.Context) {
|
||||
f5.GetSysLog().Info("CaForward create request url:%s error:%s", newUrl, createErr)
|
||||
return
|
||||
}
|
||||
if downStreamHost != "" {
|
||||
httpRequest.Host = downStreamHost
|
||||
}
|
||||
client := &http.Client{}
|
||||
if resp, err := client.Do(httpRequest); err == nil {
|
||||
defer resp.Body.Close()
|
||||
|
@ -174,3 +174,8 @@ func (this *sApiForward) outputMonitorLog() {
|
||||
time.Sleep(time.Second * 10)
|
||||
}
|
||||
}
|
||||
|
||||
func (this *sApiForward) GetDownStreamHost() (string, string) {
|
||||
newUrl := mt.Table.Config.GetById(0).GetRedirectUrl()
|
||||
return newUrl, ""
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user