From 409d6b6ce2d3c25035e825f190272a71b2d74c6f Mon Sep 17 00:00:00 2001 From: Andreas Knuth Date: Fri, 21 Feb 2025 13:15:07 -0600 Subject: [PATCH] check for api --- caddy/Caddyfile | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/caddy/Caddyfile b/caddy/Caddyfile index 0413e4f..ce8e674 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -17,35 +17,29 @@ bayarea-cc.com, www.bayarea-cc.com { dns cloudflare q1P7J3uqS96FGj_iiX2mI8y1ulTaIFrTp8tyTXhG } - # Statische Dateien aus dem Angular Build-Verzeichnis - # root * /app - # file_server - # Fallback für Angular SPA Routing - # try_files {path} /index.html - handle { - root * /app - try_files {path} {path}/ /index.html - file_server - } - - # Reverse Proxy für API-Anfragen an Nest.js + # Reverse Proxy für API-Anfragen (hat Vorrang) @api { path /api/* } - reverse_proxy @api localhost:3001 { - # Optional: Header für Debugging + reverse_proxy @api host.docker.internal:3001 { header_up X-Real-IP {remote_host} } + # Statische Dateien nur für nicht-API-Pfade + @notApi { + not path /api/* + } + root * /app + file_server @notApi { + try_files {path} /index.html + } - - # Logging (optional) + # Logging für Debugging log { - output file /var/log/caddy/bayarea-cc.log + output stderr format console } - # Komprimierung für bessere Performance encode gzip } auth.bizmatch.net {