Optize font performance
This commit is contained in:
@@ -54,7 +54,13 @@ func main() {
|
||||
h := &handler{root: root, user: *user, pass: *pass}
|
||||
|
||||
staticFS, _ := fs.Sub(assets, "assets")
|
||||
http.Handle("/_/", http.StripPrefix("/_/", http.FileServer(http.FS(staticFS))))
|
||||
static := http.StripPrefix("/_/", http.FileServer(http.FS(staticFS)))
|
||||
http.Handle("/_/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if strings.HasPrefix(r.URL.Path, "/_/fonts/") {
|
||||
w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
|
||||
}
|
||||
static.ServeHTTP(w, r)
|
||||
}))
|
||||
http.Handle("/", h)
|
||||
|
||||
log.Printf("datascape listening on %s, wiki at %s", *addr, root)
|
||||
|
||||
Reference in New Issue
Block a user