-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: Permit Cache-Control (browser caching) for datasource resources #62033
Conversation
7cfce8f
to
70401d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, added a suggestion
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
…62033) * Start work on allowing certain resources to pass through Cache-Control headers. --------- Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
|
||
foundPrivate := false | ||
foundPublic := false | ||
for _, val := range ccHeaderValues { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ccHeaderValues is a string of comma separated values, so if the cache control includes a max-age this check will fail.
For example, I would expect to be able to set the following headers in the datasource resource.go:
Cache-Control: private, max-age=806400
X-Grafana-Cache: y
and have that pass this check.
This will allow Cache-Control trough and not overwrite it if:
X-Grafana-Cache
header is setThe more immediate goal is to allow certain resources in Prometheus to be cached to improve query builder specifically. This is a piece of that.
X-Grafana-Cache
is a header that I believe I just made up (there is aX-Grafana-NoCache
already). The idea is to make it "opt-in", so this change doesn't unintentionally change other data sources in unanticipated ways.