Improve web UI sound deployment
This commit is contained in:
1 parent
c3a9b05392
commit
439f65ec6c
2 files changed
+18
-2
No files matched your search
@@ -193,11 +193,22 @@ func makeCachable(w http.ResponseWriter, p string, fi os.FileInfo, cachable bool
|
||||
cc := normalCacheControl
|
||||
if strings.HasPrefix(p, "/third-party/") {
|
||||
cc = veryCachableCacheControl
|
||||
} else if isFirstPartyWebAsset(p) {
|
||||
cc = "no-cache"
|
||||
}
|
||||
|
||||
w.Header().Set("Cache-Control", cc)
|
||||
}
|
||||
|
||||
func isFirstPartyWebAsset(p string) bool {
|
||||
switch path.Ext(p) {
|
||||
case ".css", ".html", ".js":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// fileHandler is our custom reimplementation of http.FileServer
|
||||
type fileHandler struct {
|
||||
root http.FileSystem
|
||||
|
||||
Reference in new issue
Block a user