fix(static): add missing AutoIndex and Internal settings in registerStaticHandlers

The registerStaticHandlers function (used in multi-server mode) was missing
AutoIndex and Internal configuration that registerStaticHandlersWithLocationEngine
already had. This caused auto_index to not work in multi-server mode.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-07 16:32:41 +08:00
parent 4b48fd71e6
commit 03c27c8d95

View File

@ -243,11 +243,24 @@ func (s *Server) registerStaticHandlers(router *handler.Router, cfg *config.Serv
// 设置符号链接安全检查
staticHandler.SetSymlinkCheck(static.SymlinkCheck)
// 设置 internal 限制
staticHandler.SetInternal(static.Internal)
// 设置缓存过期时间
if static.Expires != "" {
staticHandler.SetExpires(static.Expires)
}
// 设置目录列表
if static.AutoIndex {
staticHandler.SetAutoIndex(
static.AutoIndex,
static.AutoIndexFormat,
static.AutoIndexLocaltime,
static.AutoIndexExactSize,
)
}
// 设置 try_files 配置
if len(static.TryFiles) > 0 {
// 注意tryFilesPass 需要路由器支持,当前实现传入 nil