Thanks Marcelo! Problem solved. I removed the host headers and it is 
working.

Updated good config:

modules:
  http_2xx:
    prober: http
    http:
      method: GET
      fail_if_not_ssl: true
      basic_auth:
        username: "username"
        password: "password"


On Friday, February 19, 2021 at 3:16:36 PM UTC-5 [email protected] 
wrote:

> Wild guess:
>
> In the tls_config part you can optionally a ServerName setting. I'm 
> guessing that's what you are trying to do with the Host header.
>
> Does using that instead fix this?
>
> On Fri, Feb 19, 2021 at 1:47 PM Kaufman Ng <[email protected]> wrote:
>
>> I am trying to use the http module to hit a REST endpoint enabled with 
>> https and basic authentication. But I keep getting 401 status. I confirmed 
>> the username and password works via curl command.
>>
>> Anything wrong with my blackbox exporter config here? Thanks in advance!
>>
>> modules:
>>   http_2xx:
>>     prober: http
>>     http:
>>       method: GET
>>       valid_status_codes: [200,401]
>>       fail_if_not_ssl: true
>>       headers:
>>         Host: "my-endpoint"
>>       basic_auth:
>>         username: "user"
>>         password: "mypassword"
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Prometheus Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/prometheus-users/cd5d797d-71a7-46dd-a55a-91a2aca3ddfbn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/prometheus-users/cd5d797d-71a7-46dd-a55a-91a2aca3ddfbn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Marcelo Magallón
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/1bd34b1d-cb96-45c7-ae80-42e9bea65d42n%40googlegroups.com.

Reply via email to