Loki: resource frontend browser cache (#110488)
feat: allow frontend to set browser cache for config endpoint
This commit is contained in:
@@ -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}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user