fix: 修复 TLS ConnectionState、SPA 回退、健康检查与监听小问题
This commit is contained in:
+7
-14
@@ -249,7 +249,11 @@ func runServe(ctx context.Context, cfg config.Config) error {
|
||||
}
|
||||
}
|
||||
|
||||
handlers := buildHandlers(nil)
|
||||
proxies, err := listener.ParseTrustedProxies(cfg.TrustedProxies)
|
||||
if err != nil {
|
||||
return fmt.Errorf("trusted_proxies: %w", err)
|
||||
}
|
||||
handlers := buildHandlers(proxies)
|
||||
shared := cfg.AdminListen == ""
|
||||
var clientHandler, adminHTTP http.Handler
|
||||
if shared {
|
||||
@@ -278,17 +282,6 @@ func runServe(ctx context.Context, cfg config.Config) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("listener: %w", err)
|
||||
}
|
||||
handlers = buildHandlers(lnSrv.Proxies())
|
||||
if shared {
|
||||
lnOpts.ClientHandler = listener.NewMux(listener.RoleShared, handlers)
|
||||
} else {
|
||||
lnOpts.ClientHandler = listener.NewMux(listener.RoleClient, handlers)
|
||||
lnOpts.AdminHandler = listener.NewMux(listener.RoleAdmin, handlers)
|
||||
}
|
||||
lnSrv, err = listener.New(lnOpts)
|
||||
if err != nil {
|
||||
return fmt.Errorf("listener: %w", err)
|
||||
}
|
||||
|
||||
if err := lnSrv.Start(ctx); err != nil {
|
||||
return err
|
||||
@@ -356,10 +349,10 @@ func staticFileHandler() http.Handler {
|
||||
}
|
||||
if f, err := sub.Open("index.html"); err == nil {
|
||||
_ = f.Close()
|
||||
return http.FileServer(http.FS(sub))
|
||||
return httpx.SPA(sub)
|
||||
}
|
||||
}
|
||||
return http.FileServer(http.FS(root))
|
||||
return httpx.SPA(root)
|
||||
}
|
||||
|
||||
func writeListenAddr(dataDir, addr string) error {
|
||||
|
||||
Reference in New Issue
Block a user