From 1de2f321b643ee2e10f78248c1b15eafc3e09b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sun, 15 Dec 2024 13:13:25 +0800 Subject: [PATCH] test --- experimental/clashapi/server.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/experimental/clashapi/server.go b/experimental/clashapi/server.go index f97e5d1065..2b4da4a4a1 100644 --- a/experimental/clashapi/server.go +++ b/experimental/clashapi/server.go @@ -128,11 +128,8 @@ func NewServer(ctx context.Context, logFactory log.ObservableFactory, options op if options.ExternalUI != "" { s.externalUI = filemanager.BasePath(ctx, os.ExpandEnv(options.ExternalUI)) chiRouter.Group(func(r chi.Router) { - fs := http.StripPrefix("/ui", http.FileServer(http.Dir(s.externalUI))) - r.Get("/ui", http.RedirectHandler("/ui/", http.StatusTemporaryRedirect).ServeHTTP) - r.Get("/ui/*", func(w http.ResponseWriter, r *http.Request) { - fs.ServeHTTP(w, r) - }) + r.Get("/ui", http.RedirectHandler("/ui/", http.StatusMovedPermanently).ServeHTTP) + r.Handle("/ui/*", http.StripPrefix("/ui/", http.FileServer(http.Dir(s.externalUI)))) }) } return s, nil