1. The problem I’m having:
I have Caddy configured as a reverse proxy for my applications and it’s working great. The problem is that the AWS ELB health checks are filling up my logs and making it difficult to see the real requests.
When I was using Nginx I configured it to drop all 200 status health checks and only log the non-200 status health checks. That way if something went wrong with the health check I could still get some detail on the error. With Caddy I’m pretty sure that I want to use skip_log
but I don’t know how to block just the 200 requests.
2. Error messages and/or full log output:
N/A
3. Caddy version:
$ caddy --version
v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=
4. How I installed and ran Caddy:
a. System environment:
Linux, Alpine 3.18.6, Docker (caddy:2.7)
b. Command:
caddy run --config /etc/caddy/Caddyfile
c. Service/unit/compose file:
Default Alpine / caddy:2.7 config
d. My complete Caddy config:
# Global config options
# https://caddyserver.com/docs/caddyfile/options
{
# turn off admin API endpoint
admin off
servers {
trusted_proxies static private_ranges
}
}
# Internal endpoint for serving healthchecks etc.
:80 {
respond /up "UP" 200
}
:3000 {
# Block API calls from the WWW
@blocked {
header x-forwarded-proto https
path /internal_api
}
respond @blocked 401
reverse_proxy cobalt2.{$LH_DATASET}:3000 {
fail_duration 30s
}
log {
output stdout
format json
}
}
:3001 {
# Block API calls from the WWW
@blocked {
header x-forwarded-proto https
path /internal_api
}
respond @blocked 401
reverse_proxy durin.{$LH_DATASET}:3001 {
fail_duration 30s
}
log {
output stdout
format json
}
}