fix proxy to https issue

This commit is contained in:
2023-09-27 14:02:12 +08:00
parent d581a65002
commit 43d3ef275e

View File

@@ -556,6 +556,13 @@ func (c *HandleController) MakeProxyFunc() func(context *gin.Context) {
res := ProxyResponse{} res := ProxyResponse{}
host := c.CommonInfo.DashboardAddr host := c.CommonInfo.DashboardAddr
port := c.CommonInfo.DashboardPort port := c.CommonInfo.DashboardPort
if strings.HasPrefix(host, "http://") {
host, _ = strings.CutPrefix(host, "http://")
} else if strings.HasPrefix(host, "https://") {
host, _ = strings.CutPrefix(host, "https://")
}
requestUrl := protocol + host + ":" + strconv.Itoa(port) + context.Param("serverApi") requestUrl := protocol + host + ":" + strconv.Itoa(port) + context.Param("serverApi")
request, _ := http.NewRequest("GET", requestUrl, nil) request, _ := http.NewRequest("GET", requestUrl, nil)
username := c.CommonInfo.DashboardUser username := c.CommonInfo.DashboardUser