Manual enable browser cache (1 hour expiry) for static assets
This commit is contained in:
parent
3f7a357b17
commit
c16ed03f22
@ -103,6 +103,8 @@ func (app *Application) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
parts := strings.Split(r.URL.Path, "/")[1:]
|
||||
switch parts[0] {
|
||||
case "static":
|
||||
// Static files can be stored in browser cache
|
||||
w.Header().Set("Cache-Control", "public, max-age=3600")
|
||||
if use_embedded == "true" {
|
||||
// Serve directly from the embedded files
|
||||
http.FileServer(http.FS(embedded_files)).ServeHTTP(w, r)
|
||||
|
Loading…
x
Reference in New Issue
Block a user