1. Output of caddy version
:
v2.5.2 h1:eCJdLyEyAGzuQTa5Mh3gETnYWDClo1LjtQm2q9RNZrs=
2. How I run Caddy:
a. System environment:
Ubuntu 20.04.4 LTS
b. Command:
none
c. Service/unit/compose file:
none
d. My complete Caddy config:
{
# Enable Debug mode
# debug
# Disable admin API
admin off
}
poc1.domain {
header {
# Hide "Server: Caddy"
-Server
}
# https://caddyserver.com/docs/caddyfile/directives/log
log {
output file /var/log/caddy/poc1.domain-error.log
format console
}
reverse_proxy * {
to poc01-backend:9392
lb_policy cookie
lb_try_duration 5s
lb_try_interval 250ms
fail_duration 30s
health_uri /status # Backend health check path
health_interval 10s
health_timeout 2s
#health_body ^(.(?!ERROR).)*$
#health_status 200
}
handle_errors {
@404-410 expression `{err.status_code} in [404, 410]`
handle @404-410 {
rewrite * 404.html
root * /usr/share/caddy
file_server
}
@5xx expression `{err.status_code} >= 500 && {err.status_code} < 600`
handle @5xx {
rewrite * maintenance.html
root * /usr/share/caddy
file_server
}
handle {
respond "It's another error"
}
}
}
3. The problem I’m having:
Hi,
i’m having two questions where i can’t figure out on how to properly configure some rather basic configurations.
first:
health body regex => our statuspage (stupidly) returns a 200 and contains an error message in the body.
how does a regex for caddy have to look, that checks the return body for the content “ERROR”?
second:
health status range => our backend returns statuscodes in the 300 range for some bootup / config stages, so we need to configure the health status to range from 2xx to 3xx, so we can check them on start.
how do i properly configure this?
4. Error messages and/or full log output:
none
5. What I already tried:
Playing around with the config above, always bumping into something wrongly formatted / config errors.