Skip to content
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

Set cache control headers in V2 API to mirror V1 #3195

Merged
merged 4 commits into from
Feb 7, 2023

Conversation

alexweav
Copy link
Contributor

@alexweav alexweav commented Dec 28, 2022

The V1 API sends CORS headers + the Cache-Control header, all the time:

var corsHeaders = map[string]string{

In V2, we replaced this with rs/cors. But, the Cache-Control header is not actually a CORS-related header, so that library does not manage it. This means the Cache-Control headers are missing in V2.

This PR adds the header in the V2 API, matching V1.

Fixes #3175

Signed-off-by: Alex Weaver [email protected]

Signed-off-by: Alex Weaver <[email protected]>
api/v2/api.go Outdated Show resolved Hide resolved
@alexweav alexweav changed the title Set cache control headers Set cache control headers in V2 API to mirror V1 Dec 28, 2022
@gotjosh
Copy link
Member

gotjosh commented Feb 7, 2023

Thank you very much for your contribution.

@gotjosh gotjosh merged commit fe1b045 into prometheus:main Feb 7, 2023
hoperays pushed a commit to hoperays/alertmanager that referenced this pull request Apr 23, 2023
* Set cache control headers
Signed-off-by: Alex Weaver <[email protected]>
radek-ryckowski pushed a commit to goldmansachs/alertmanager that referenced this pull request Nov 6, 2023
* Set cache control headers
Signed-off-by: Alex Weaver <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache-control headers aren't set for v2 api
2 participants