Case sensitive scheme Bearer authentication (using Prometheus)?
Answered
Hi,
I'm trying to scrape my Teamcity server metris with Prometheus.
I have configured a user account with due permissions, and setup Prometheus configuration in order to scrape using the appropriate bearer token.
But I think that Prometheus is sending a Authorization header with "bearer" instead of "Bearer": actually, I don't know what kind of http request Prometheus is issuing, but I have tested some http calls and it is confirmed that passing in Authorization: bearer <token> is rejected by Teamcity with a 401 response, which I think is the case of Prometheus scraper.
Any suggestions?
Please sign in to leave a comment.
Hello!
Yes, the header is case sensitive. I am not sure if Prometheus allows to modify the authentication schema for remote targets (so that capitalized Bearer would be used).
As I understand, though, Prometheus allows to set up a target for scraping with basic auth: https://prometheus.io/docs/guides/basic-auth/
TeamCity REST API also allows usage of basic auth: https://www.jetbrains.com/help/teamcity/rest-api.html#RESTAPI-RESTAuthentication
Specifically, you can append /httpAuth before /app/rest endpoint parts:
Would this approach work for you?