How do I respond on ssl error when using on demand tls?

1. Output of caddy version:

v2.6.1 h1:EDqo59TyYWhXQnfde93Mmv4FJfYe00dO60zMiEt+pzo=

2. How I run Caddy:

sudo systemctl restart caddy.service

a. System environment:

debian 11

d. My complete Caddy config:

{
        on_demand_tls {
                ask https://example.com/check
                interval 2m
                burst 5
        }
}

:80, :443 {
        reverse_proxy https://example.com {
                header_up Host {upstream_hostport}
        }
        tls {
                on_demand
        }
        handle_errors {
                respond "404 Not Found"
        }
}

3. The problem I’m having:

When my ask fail for on_deman_tls I expect to see “404 Not Found” respond for handle_errors. I see ERR_SSL_PROTOCOL_ERROR from chrome.

HTTP responses can only be sent after a connection is established, so if no connection can be established, an HTTP response is impossible. (This is not unique to Caddy. That’s just how the Web works.)

This topic was automatically closed after 30 days. New replies are no longer allowed.