feat: change default proxy.conf (#8971)

This commit is contained in:
CityFun 2025-06-09 22:31:05 +08:00 committed by GitHub
parent 24d909d285
commit 8b9337b45a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View file

@ -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;

View file

@ -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

View file

@ -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()
}