diff --git a/agent/cmd/server/nginx_conf/proxy.conf b/agent/cmd/server/nginx_conf/proxy.conf index 14e14f2db..7ae096a82 100644 --- a/agent/cmd/server/nginx_conf/proxy.conf +++ b/agent/cmd/server/nginx_conf/proxy.conf @@ -7,6 +7,7 @@ location ^~ /test { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; proxy_http_version 1.1; add_header X-Cache $upstream_cache_status; diff --git a/core/cmd/server/web/web.go b/core/cmd/server/web/web.go index dc7a3d3b0..ec5812201 100644 --- a/core/cmd/server/web/web.go +++ b/core/cmd/server/web/web.go @@ -8,8 +8,5 @@ var IndexHtml embed.FS //go:embed assets/* var Assets embed.FS -//go:embed index.html -var IndexByte []byte - //go:embed favicon.png var Favicon embed.FS diff --git a/core/utils/security/security.go b/core/utils/security/security.go index 2fcc6867d..b22604ea7 100644 --- a/core/utils/security/security.go +++ b/core/utils/security/security.go @@ -56,7 +56,12 @@ func CheckSecurity(c *gin.Context) bool { func ToIndexHtml(c *gin.Context) { c.Writer.Header().Set("Content-Type", "text/html; charset=utf-8") c.Writer.WriteHeader(http.StatusOK) - _, _ = c.Writer.Write(web.IndexByte) + data, err := web.IndexHtml.ReadFile("index.html") + if err != nil { + c.String(http.StatusInternalServerError, "index.html not found") + return + } + _, _ = c.Writer.Write(data) c.Writer.Flush() }