Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: 404 page return 200 status code

sy-records94828f71d1d4
diff --git a/internal/router/ui.go b/internal/router/ui.go
index 1d68384e..b959bcd3 100644
--- a/internal/router/ui.go
+++ b/internal/router/ui.go
@@ -120,10 +120,8 @@ func (a *UIRouter) Register(r *gin.Engine, baseURLPath string) {
} else {
c.Header("content-type", "image/vnd.microsoft.icon")
filePath = UIRootFilePath + urlPath
-
}
case "/manifest.json":
- // filePath = UIRootFilePath + urlPath
a.siteInfoController.GetManifestJson(c)
return
case "/install":
@@ -154,6 +152,12 @@ func (a *UIRouter) Register(r *gin.Engine, baseURLPath string) {
c.String(http.StatusOK, strings.ReplaceAll(string(file), "/static", cdnPrefix+"/static"))
return
}
+
+ if filePath == UIIndexFilePath {
+ c.String(http.StatusNotFound, string(file))
+ return
+ }
+
c.String(http.StatusOK, string(file))
})
}