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

DoGetFallback: fallback to GET when POST is forbidden (e.g. when behind a RBAC proxy) #1619

Open
jotak opened this issue Sep 5, 2024 · 0 comments

Comments

@jotak
Copy link

jotak commented Sep 5, 2024

Version used for observed issue: v1.19.0 (looking at the main code, it's still an issue: https://github.com/prometheus/client_golang/blob/main/api/prometheus/v1/api.go#L1453

Currently, some of the API functions to query metrics use a POST method, and fallback to GET when a status "Not allowed" or "Not implemented" is returned; cf DoGetFallback function.

When Prometheus is used behind a RBAC proxy, users might have permissions for GET (associated with reading) but not for POST (associated with writing). So a POST query might return a 403 error while the GET would succeed.

I'd suggest adding a check for 403 response code as a valid trigger for the GET fallback. What do you think? I'm happy to open a PR if that sounds good to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant