From 85c7e12af92e0dc8912b75df1c697599af22b31d Mon Sep 17 00:00:00 2001 From: Eric Bower Date: Sun, 8 Dec 2024 13:00:49 -0500 Subject: [PATCH] fix(pgs): cache custom domains Reference: https://github.com/caddyserver/cache-handler/issues/115#issuecomment-2526213257 --- .gitignore | 1 + caddy/Caddyfile.pgs | 48 ++++++++++++++++++++++++++++++++------------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index a63385bb..242d8540 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ ssh_data __debug_bin .bin /public/ +caddy/caddy diff --git a/caddy/Caddyfile.pgs b/caddy/Caddyfile.pgs index 74fb293a..aa2a6ad8 100644 --- a/caddy/Caddyfile.pgs +++ b/caddy/Caddyfile.pgs @@ -18,6 +18,34 @@ } } +:443 { + reverse_proxy web:3000 + log { + format append { + server_id {$APP_DOMAIN} + } + } + + #tls internal { + # on_demand + #} + tls {$APP_EMAIL} { + on_demand + } + + encode zstd gzip + route { + cache { + regex { + exclude /check + } + key { + template {http.request.method}-{http.request.path} + } + } + } +} + *.{$APP_DOMAIN}, {$APP_DOMAIN} { reverse_proxy web:3000 log { @@ -25,10 +53,13 @@ server_id {$APP_DOMAIN} } } + + #tls internal tls {$APP_EMAIL} { dns cloudflare {$CF_API_TOKEN} resolvers 1.1.1.1 } + route { @souinApi path /souin-api/* basic_auth @souinApi { @@ -38,8 +69,10 @@ regex { exclude /check } + key { + template {http.request.method}-{http.request.path} + } } - reverse_proxy web:3000 } encode zstd gzip @@ -117,16 +150,3 @@ monitoring.{$MONITORING_APP_DOMAIN}, prometheus.{$MONITORING_APP_DOMAIN}, grafan disable_openmetrics } } - -:443 { - reverse_proxy web:3000 - log { - format append { - server_id {$APP_DOMAIN} - } - } - tls {$APP_EMAIL} { - on_demand - } - encode zstd gzip -}