From 43d3ef275e99a28cff7623d05e1d4aad2c6afa8e Mon Sep 17 00:00:00 2001 From: yanghuanglin Date: Wed, 27 Sep 2023 14:02:12 +0800 Subject: [PATCH] fix proxy to https issue --- pkg/server/controller/controller.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/server/controller/controller.go b/pkg/server/controller/controller.go index 6059044..75fdcdd 100644 --- a/pkg/server/controller/controller.go +++ b/pkg/server/controller/controller.go @@ -556,6 +556,13 @@ func (c *HandleController) MakeProxyFunc() func(context *gin.Context) { res := ProxyResponse{} host := c.CommonInfo.DashboardAddr 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") request, _ := http.NewRequest("GET", requestUrl, nil) username := c.CommonInfo.DashboardUser