-
Notifications
You must be signed in to change notification settings - Fork 803
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
Add Origin header for Query API #5388
Add Origin header for Query API #5388
Conversation
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.
Thanks for your contribution. I am ok with making the value configurable. Just mention that is only valid for the ruler for now.
Also:
- Sign DCO
- Include tests
- Modify changelog
pkg/ruler/api.go
Outdated
|
||
w.Header().Set("Content-Type", "application/json") | ||
if disableCORS != true { | ||
w.Header().Set("Access-Control-Allow-Origin", "*") |
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.
why not make the value configurable? I think other things different than star are useful too
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
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.
Okay, good idea 👍
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.
This is how Prometheus does this https://github.com/prometheus/prometheus/blob/main/util/httputil/cors.go#L30
If we want to implement this for Query API, can I adapt an |
@cathy-qiu Can you try to use a common wrapper instead of changing every method? |
9cacf35
to
6f85afb
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.
almost there, fix the lint issues too
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
ed97b94
to
a099c5a
Compare
a099c5a
to
1f9484a
Compare
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
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.
Thanks!
Signed-off-by: Cathy Qiu <cathyqiu@amazon.com>
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.
Thank you 🙇
What this PR does:
This PR adds the
Access-Control-Allow-Origin
header to the response of Query API. The functionality replicates how Prometheus sets CORS here. This is needed because I am trying to create a tool that calls a Cortex API from the browser and I am getting a CORS header error.Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]