Loki: resource frontend browser cache (#110488)

feat: allow frontend to set browser cache for config endpoint
This commit is contained in:
Galen Kistler
2025-09-26 07:18:20 -05:00
committed by GitHub
parent 0163d1888e
commit a8bff45256
+7
View File
@@ -162,6 +162,13 @@ func callResource(ctx context.Context, req *backend.CallResourceRequest, sender
respHeaders := map[string][]string{
"content-type": {"application/json"},
}
// frontend sets the X-Grafana-Cache with the desired response cache control value
if len(req.GetHTTPHeaders().Get("X-Grafana-Cache")) > 0 {
respHeaders["X-Grafana-Cache"] = []string{"y"}
respHeaders["Cache-Control"] = []string{req.GetHTTPHeaders().Get("X-Grafana-Cache")}
}
if rawLokiResponse.Encoding != "" {
respHeaders["content-encoding"] = []string{rawLokiResponse.Encoding}
}