fix: 静态文件路径 / 在 Auth 白名单中放行(供 Web UI 直接访问)

This commit is contained in:
xiaowei 2026-06-02 17:34:28 +08:00
parent 293ae82fb2
commit 0bda9a8420
1 changed files with 3 additions and 2 deletions

View File

@ -129,8 +129,9 @@ func Auth(next http.Handler) http.Handler {
}
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// /health, /metrics, /static/* 不需要认证
if r.URL.Path == "/health" || r.URL.Path == "/metrics" || strings.HasPrefix(r.URL.Path, "/static/") {
// /health, /metrics, /static/*, / 不需要认证(/ 供 Web UI 使用)
if r.URL.Path == "/health" || r.URL.Path == "/metrics" ||
strings.HasPrefix(r.URL.Path, "/static/") || r.URL.Path == "/" {
next.ServeHTTP(w, r)
return
}