feat: update Caddy config, add cache, improve response handling and logging

This commit is contained in:
Arthur K. 2025-01-21 14:21:40 +03:00
parent ef2f477fcd
commit 18828ca720
Signed by: wzray
GPG key ID: B97F30FDC4636357
6 changed files with 162 additions and 96 deletions

View file

@ -1,10 +1,35 @@
https://, ядро.орг, *.ядро.орг {
tls internal
{
cache
log {
format console
level WARN
}
}
http://ядро.орг, http://*.ядро.орг {
tls internal
encode gzip zstd
import Caddyfile.yadro localhost:8000
cache {
# we don't want to flood the upstream from the same IP
mode bypass
ttl 30m
}
import Caddyfile.yadro proxy:80
}
http://localhost:9000 {
import Caddyfile.puppies localhost:9001-9010
:9000 {
reverse_proxy {
dynamic a puppy 80
lb_policy least_conn
}
cache {
allowed_http_verbs POST
ttl 7d
timeout {
backend 1m
}
}
}

View file

@ -1,6 +0,0 @@
reverse_proxy {
to {args[0]}
lb_policy least_conn
}
# TODO: infinite cache by path+body

8
caddy/Dockerfile Normal file
View file

@ -0,0 +1,8 @@
FROM caddy:builder AS builder
RUN --mount=type=cache,target=/go/pkg/mod xcaddy build \
--with github.com/caddyserver/cache-handler
FROM caddy:latest
COPY --from=builder /usr/bin/caddy /usr/bin/caddy