`health_check` - User Agent

In Caddy 1.0.3 is there a way to specify the “User Agent” for HTTP “health_check” requests?

I’m seeing "Go-http-client/1.1" user agent being used - sadly my up stream provider is blocking all requests by this user agent and will not change this.

I work around this for tls ask requests by proxying (with Caddy) those and adding in a different user agent header.

I’m not seeing an obvious way to do that for the health_check requests.
Any ideas?

If not with Caddy 1.x - perhaps Caddy 2?

1 Like

We can make this configurable for active health checks in Caddy 2, sure.

@DeanMarkTaylor I just whipped this together real quick. Can you give this commit a try? https://github.com/caddyserver/caddy/commit/44cb804b9e5bc2779cf971862c37a1e3b4671e26

It should override any default headers with ones you specify:

{
    "handler": "reverse_proxy",
    "health_checks": {
        "active": {
            "headers": {
                "User-Agent": []
            }
        }
    }
}
1 Like