Reuse static server for multiple requests (#2258)

This commit is contained in:
Viacheslav Poturaev 2022-01-28 05:20:05 +01:00 committed by GitHub
parent 0388aec942
commit d9fb51f2f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -184,6 +184,7 @@ func Start(uiBox embed.FS, loginUIBox embed.FS) {
}
customUILocation := c.GetCustomUILocation()
static := statigz.FileServer(uiBox)
// Serve the web app
r.HandleFunc("/*", func(w http.ResponseWriter, r *http.Request) {
@ -222,7 +223,7 @@ func Start(uiBox embed.FS, loginUIBox embed.FS) {
}
r.URL.Path = uiRootDir + r.URL.Path
statigz.FileServer(uiBox).ServeHTTP(w, r)
static.ServeHTTP(w, r)
}
})