tiny fixes

This commit is contained in:
Alireza Ahmadi
2024-03-01 13:10:06 +01:00
parent edc1038623
commit f5b609204e
4 changed files with 23 additions and 5 deletions
+4
View File
@@ -108,6 +108,10 @@ func (s *Server) initRouter() (*gin.Engine, error) {
// Serve index.html as the entry point
// Handle all other routes by serving index.html
engine.NoRoute(func(c *gin.Context) {
if c.Request.URL.Path == strings.TrimSuffix(base_url, "/") {
c.Redirect(http.StatusTemporaryRedirect, base_url)
return
}
if !strings.HasPrefix(c.Request.URL.Path, base_url) {
c.String(404, "")
return