fix(web-proxy): fix dashboard cache headers, force path lowercase in metrics

This commit is contained in:
spiral 2022-12-03 11:59:36 +00:00
parent 939a727969
commit 372eef72f4
No known key found for this signature in database
GPG Key ID: 244A11E4B0BCF40E
2 changed files with 3 additions and 1 deletions

View File

@ -111,7 +111,7 @@ func modifyDashResponse(resp *http.Response) error {
(strings.HasSuffix(r.URL.Path, ".js") || strings.HasSuffix(r.URL.Path, ".css") || strings.HasSuffix(r.URL.Path, ".map")) (strings.HasSuffix(r.URL.Path, ".js") || strings.HasSuffix(r.URL.Path, ".css") || strings.HasSuffix(r.URL.Path, ".map"))
if is_dash_static_asset && resp.StatusCode == 200 { if is_dash_static_asset && resp.StatusCode == 200 {
resp.Header.Add("Cache-Control", "max-age: 604800") resp.Header.Add("Cache-Control", "max-age=31536000, s-maxage=31536000, immutable")
} }
return logTimeElapsed(resp) return logTimeElapsed(resp)

View File

@ -40,6 +40,8 @@ func cleanPath(host, path string) string {
return "" return ""
} }
path = strings.ToLower(path)
if !(strings.HasPrefix(path, "/v2") || strings.HasPrefix(path, "/private")) { if !(strings.HasPrefix(path, "/v2") || strings.HasPrefix(path, "/private")) {
return "" return ""
} }