app/vmselect: follow-up for 348c1bcec0: cache static contents served from /select/tenantID/prometheus/vmui/static/...

This commit is contained in:
Aliaksandr Valialkin 2023-10-16 23:27:04 +02:00
parent a6ad9208ef
commit 8642418e5a
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -366,7 +366,7 @@ func selectHandler(qt *querytracer.Tracer, startTime time.Time, w http.ResponseW
} }
if strings.HasPrefix(p.Suffix, "vmui/") || strings.HasPrefix(p.Suffix, "prometheus/vmui/") { if strings.HasPrefix(p.Suffix, "vmui/") || strings.HasPrefix(p.Suffix, "prometheus/vmui/") {
// vmui access. // vmui access.
if strings.HasPrefix(p.Suffix, "vmui/static/") { if strings.HasPrefix(p.Suffix, "vmui/static/") || strings.HasPrefix(p.Suffix, "prometheus/vmui/static/") {
// Allow clients caching static contents for long period of time, since it shouldn't change over time. // Allow clients caching static contents for long period of time, since it shouldn't change over time.
// Path to static contents (such as js and css) must be changed whenever its contents is changed. // Path to static contents (such as js and css) must be changed whenever its contents is changed.
// See https://developer.chrome.com/docs/lighthouse/performance/uses-long-cache-ttl/ // See https://developer.chrome.com/docs/lighthouse/performance/uses-long-cache-ttl/