feat: update Caddy config, add cache, improve response handling and logging
This commit is contained in:
parent
ef2f477fcd
commit
18828ca720
6 changed files with 162 additions and 96 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
reverse_proxy {
|
||||
to {args[0]}
|
||||
lb_policy least_conn
|
||||
}
|
||||
|
||||
# TODO: infinite cache by path+body
|
8
caddy/Dockerfile
Normal file
8
caddy/Dockerfile
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue