78 404 when the application put under nginx subdirectory with proxy pass (#79)

* use http.FileServer insetead of custom middleware

* fixed behavior under reverse proxy

* enabled reverse proxy subfolder as "domain value"

* domain validation

* code refactoring

* code refactoring

* updated translation
This commit is contained in:
Marco
2023-08-21 12:24:50 +02:00
committed by GitHub
parent a005f159c6
commit c50c1f627e
8 changed files with 55 additions and 29 deletions

View File

@@ -43,7 +43,6 @@ func RunBlocking(port int, frontend fs.FS) {
mq: mq,
})
// http-post
go gracefulShutdown(srv, &db)
go autoPersist(time.Minute*5, &db)
@@ -59,12 +58,9 @@ func newServer(c serverConfig) *http.Server {
r.Use(cors.AllowAll().Handler)
r.Use(middleware.Logger)
sh := middlewares.NewSpaHandler("index.html", c.frontend)
sh.AddClientRoute("/settings")
sh.AddClientRoute("/archive")
sh.AddClientRoute("/login")
app := http.FileServer(http.FS(c.frontend))
r.Get("/*", sh.Handler())
r.Mount("/", app)
// Archive routes
r.Route("/archive", func(r chi.Router) {