Getting redirected on a scrape with a client token

Hi

I’m trying to scrape the prometheus endpoint of our Teamcity server. I can verify accessing the the endpoint with a generated access token using curl, Chrome and the go http client. But when prometheus tries scraping the endpoint it gets a 302 redirection loop. The only time the endpoint should do a redirect is if the request is unauthenticated. You will be redirected to a login page.

Here is my scrape conf:
- job_name: “teamcity”
metrics_path: “/app/metrics”
scheme: “https”
params:
experimental:
- “true”
bearer_token: “{{teamcity_bearer_token}}”
static_configs:
- targets:
- “<teamcity_url>”

I’ve upgraded to 2.27.1 in order to also give try the “follow_redirects” parameter and the new authorization config, but it didn’t make a difference.

If I set follow_redirects to true the scrape output just tells me it got a 302.

I have scrapes using tokens running against Hashicorp vault without issues, and I get the expected results from curl, Chrome and the go http client. Anyone stumbled across something like this?