Skip to content

Commit 06af3e3

Browse files
committed
client/web: only add cache header for assets
Updates tailscale#10261 Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
1 parent 808f19b commit 06af3e3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

client/web/assets.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ func assetsHandler(devMode bool) (_ http.Handler, cleanup func()) {
5252
return
5353
}
5454

55-
// Aggressively cache static assets, since we cache-bust our assets with
56-
// hashed filenames.
57-
w.Header().Set("Cache-Control", "public, max-age=31535996")
58-
w.Header().Set("Vary", "Accept-Encoding")
55+
if strings.HasPrefix(path, "assets/") {
56+
// Aggressively cache static assets, since we cache-bust our assets with
57+
// hashed filenames.
58+
w.Header().Set("Cache-Control", "public, max-age=31535996")
59+
w.Header().Set("Vary", "Accept-Encoding")
60+
}
5961

6062
http.ServeContent(w, r, path, start, fSeeker)
6163
}), nil

0 commit comments

Comments
 (0)