1. Output of caddy version
:
2.5.2-alpine docker image.
2. How I run Caddy:
I built a custom caddy image with the rate limiter plugin.
FROM caddy:2.5.2-builder-alpine AS builder
RUN xcaddy build \
--with github.com/mholt/caddy-ratelimit
FROM caddy:2.5.2-alpine
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
a. System environment:
2.5.2-alpine docker image. Docker running on Ubuntiu 22.04.
b. Command:
docker-compose up
c. Service/unit/compose file:
services:
caddy:
container_name: caddy_rl
image: caddy_rl
restart: unless-stopped
ports:
- "80:80"
# - "443:443"
volumes:
- ./caddy/Caddyfile:/etc/caddy/Caddyfile
# - $PWD/site:/srv
- /home/.../caddie_data/:/data
- /home/.../caddy_config:/config
- /home/.../uploads/:/var/www/uploads/img/
- /home/.../caddy_logs/:/var/log/
d. My complete Caddy config:
{
admin off
order rate_limit before basicauth
log {
output file /var/log/access.log {
roll_size 40MiB
roll_uncompressed
roll_local_time
}
}
}
(common) {
header /* {
-Server
}
}
http://mtkk.localhost {
@static_asset {
path_regexp static \.(webp|svg|css|js|jpg|png|gif|ico|woff|woff2)$
}
@hashed_asset {
path_regexp static \.(css|js)$
}
log
header {
# # disable FLoC tracking
# Permissions-Policy interest-cohort=()
# # enable HSTS
# Strict-Transport-Security max-age=31536000;
# disable clients from sniffing the media type
X-Content-Type-Options nosniff
# clickjacking protection
X-Frame-Options DENY
# keep referrer data off of HTTP connections
Referrer-Policy no-referrer-when-downgrade
}
rate_limit {
distributed
zone static_example {
key static
events 100
window 1m
}
}
root * /var/www/uploads/img/
file_server @static_asset
reverse_proxy adonis_app:3333
encode zstd gzip
header ?Cache-Control max-age=3600
header @hashed_asset Cache-Control max-age=31536000
import common
}
3. The problem Iâm having:
Itâs not a problem. I am new to Caddie and would like to ask:
- Is the api admin enabled by default?
- How to disable logs with a matcher, or what other pattern is commonly used? Basically I would like to disable access logs for static files.
- The logs are not working unless I move the log settings inside the site section. Why?
Also, please feel free to critique the whole config file.
4. Error messages and/or full log output:
5. What I already tried:
log @static_asset {}
log @static_asset off
These are not valid.