i’m having two questions where i can’t figure out on how to properly configure some rather basic configurations.
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”?
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:
5. What I already tried:
Playing around with the config above, always bumping into something wrongly formatted / config errors.
If you do, you won’t be able to reload Caddy (for graceful config changes) so you’ll have to restart the whole process which can cause downtime.
There’s no benefit to removing this header. It doesn’t hide anything that people couldn’t otherwise figure out about your server.
If you only have a single backend, I don’t think you’ll really get any benefit from enabling load balancing or health check features. It only becomes useful if you have multiple upstreams configured, where if one goes down, another could pick up the slack.
That said, you can play around with https://regex101.com/ with the Golang flavor to craft the regexp you need.
Unfortunately, we don’t currently support ranges with a different first number. You can only do 2xx or 3xx but not both.
Wouldn’t it make the most sense to just match on 2xx though, since 3xx means it’s still booting up? If it’s booting up, that means it’s not ready yet, so marking it as healthy doesn’t seem correct.
admin off => this is a remnant of some experiments we did. i removed it from our automation and it will be gone with the next config update
-server => same thing. we played around with the configs and forgot to remove this (since it doesn’t hurt )
upstreams => copy paste error on my end. we have 2-5 backend nodes behind each caddy. so it makes sense since we actually want to load balance. i’ll play around with the page you suggested.
health status => i had hoped to be able to build a workaround with an expression or something similar.
we actually get some boot up information (down to specific error messages) on the web frontend of our applications, which makes starting issues easier to diagnose than digging through the log files.
since we can freely adjust our DNS entries, i might set up something like maintenance.domain which checks for health status 300 - so we get some sort of workaround that way.