From ca39330df5fa7b9533664c91e8eb65063e9f2e29 Mon Sep 17 00:00:00 2001 From: "Arthur K." Date: Sat, 31 Jan 2026 15:01:24 +0300 Subject: [PATCH] =?UTF-8?q?=D1=85=D0=BE=D0=B7=D1=8F=D0=B9=D1=81=D1=82?= =?UTF-8?q?=D0=B2=D0=B5=D0=BD=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=B0:=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D0=BE=20=D0=BF=D0=BE=D0=B7=D0=B2=D0=BE=D0=BB=D0=B8=D1=82=D0=B5?= =?UTF-8?q?=20=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF,=20=D0=B7=D0=B0=D0=B3?= =?UTF-8?q?=D1=80=D1=83=D0=B6=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20=D1=87=D0=B0?= =?UTF-8?q?=D0=B9=D0=BD=D0=B8=D1=86=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- caddy/Caddyfile | 80 +++++++++++++++++++++++++++--------------------- caddy/Dockerfile | 3 +- 2 files changed, 47 insertions(+), 36 deletions(-) diff --git a/caddy/Caddyfile b/caddy/Caddyfile index 3be3842..2c41cc5 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -1,50 +1,60 @@ { - cache - log { - format console - level WARN - } + cache + + log { + level INFO + format transform `{request>client_ip} - {user_id} [{ts}] "{request>method} {request>uri} {request>proto}" {status} {size} "{request>headers>Referer>[0]}" "{request>headers>User-Agent>[0]}"` { + time_format "02/Jan/2006: 15:04:05 -0700" + } + } + + servers :80 { + trusted_proxies static private_ranges + client_ip_headers X-Forwarded-For X-Real-IP + } } http://ядро.орг, http://*.ядро.орг { - tls internal - encode gzip zstd + tls internal + encode gzip zstd - cache { - # we don't want to flood the upstream from the same IP - mode bypass - ttl 30m + log - timeout { - backend 10m - } - } + cache { + # we don't want to flood the upstream from the same IP + mode bypass + ttl 30m - import Caddyfile.yadro proxy:80 + timeout { + backend 10m + } + } + + import Caddyfile.yadro proxy:80 } :9000 { - reverse_proxy { - dynamic a puppy 80 - lb_policy least_conn + reverse_proxy { + dynamic a puppy 80 + lb_policy least_conn - transport http { - response_header_timeout 10m - read_timeout 10m - write_timeout 10m - } - } + transport http { + response_header_timeout 10m + read_timeout 10m + write_timeout 10m + } + } - cache { - allowed_http_verbs POST - ttl 7d + cache { + allowed_http_verbs POST + ttl 7d - key { - headers X-Translation-Direction - } + key { + headers X-Translation-Direction + } - timeout { - backend 10m - } - } + timeout { + backend 10m + } + } } diff --git a/caddy/Dockerfile b/caddy/Dockerfile index a2e47ee..40f6cc0 100644 --- a/caddy/Dockerfile +++ b/caddy/Dockerfile @@ -1,6 +1,7 @@ FROM caddy:builder AS builder RUN --mount=type=cache,target=/go/pkg/mod xcaddy build \ - --with github.com/caddyserver/cache-handler + --with github.com/caddyserver/cache-handler \ + --with github.com/caddyserver/transform-encoder FROM caddy:latest COPY --from=builder /usr/bin/caddy /usr/bin/caddy