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:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user