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