From 070aa8a65f27d25ca27f2aaad162793f14f3944d Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Tue, 10 Oct 2023 22:57:39 +0800 Subject: [PATCH] Show 404 error for index.html not found --- routers/static_filter.go | 1 + 1 file changed, 1 insertion(+) diff --git a/routers/static_filter.go b/routers/static_filter.go index 0d649879..9dbf4d02 100644 --- a/routers/static_filter.go +++ b/routers/static_filter.go @@ -77,6 +77,7 @@ func StaticFilter(ctx *context.Context) { panic(err) } dir = strings.ReplaceAll(dir, "\\", "/") + ctx.ResponseWriter.WriteHeader(http.StatusNotFound) errorText := fmt.Sprintf("The Casdoor frontend HTML file: \"index.html\" was not found, it should be placed at: \"%s/web/build/index.html\". For more information, see: https://casdoor.org/docs/basic/server-installation/#frontend-1", dir) http.ServeContent(ctx.ResponseWriter, ctx.Request, "Casdoor frontend has encountered error...", time.Now(), strings.NewReader(errorText)) return