1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-08-13 20:04:49 +02:00

Chore: Enable browser cache for embedded web UI assets

This commit is contained in:
Ralph Slooten
2025-02-09 09:47:45 +13:00
parent be94385f38
commit 8f1b7b6ec0

View File

@@ -41,6 +41,11 @@ func embedController(w http.ResponseWriter, r *http.Request) {
b = []byte(strings.ReplaceAll(string(b), "%%NONCE%%", nonce))
}
// allow browser cache except for ?dev queries and HTML files
if r.URL.RawQuery != "dev" && !strings.HasSuffix(p, ".html") {
w.Header().Set("Cache-Control", "max-age=31536000, public, immutable")
}
w.Header().Set("Content-Type", contentType(p))
_, _ = w.Write(b)
}