Search code examples
httpsprometheushttp2black-box-testingprometheus-blackbox-exporter

Prometheus blackbox exporter failing https but not http


I have the below config for a module. The only thing this module is used for is a website that returns a 403. When using http it works fine when using https it fails.

  proxy_http_4xx:
    prober: http
    timeout: 5s
    http:
      valid_http_versions:
        - "HTTP/1.1"
        - "HTTP/2"
      valid_status_codes:
        - 403
      method: GET
      headers:
        User-Agent: prometheus-blackbox_exporter
        Accept-Language: en-US
      no_follow_redirects: false
      fail_if_ssl: false
      fail_if_not_ssl: false
      tls_config:
        insecure_skip_verify: true
      preferred_ip_protocol: "ip4"
      proxy_url: http://proxy.com:1111

Solution

  • The answer is likely due to the config being typed incorrectly. Http/2 used to be called http/2.0 and the blackbox exporter never updated the name for this so http/2 will fail.

          valid_http_versions:
            - "HTTP/1.1"
            - "HTTP/2.0"
    

    The reason it still works on http is because http/2 will not work on insecure connections in almost all browsers. It's no longer mandatory, but most browsers choose not to support it. This is why using http it works fine since it is changed to http/1.1. You can verify this by opening the network tab in inspector mode and viewing request.