From a6af4f5646727cb4b5dffb0a83ee077abe04b956 Mon Sep 17 00:00:00 2001 From: david kiania Date: Wed, 10 Jun 2026 13:23:26 +0300 Subject: [PATCH] fix(caddy): evaluate {{env}} in env.js (templates mime) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Caddy `templates` only processes text/html + text/plain by default, so the text/javascript env.js was served with {{env "API_BASE"}} unevaluated (a literal that's also a JS parse error). Name the JS MIME types in the templates directive so the API_BASE injection works — required for prod to point at the prod API (staging worked only via the index.html fallback). Co-Authored-By: Claude Opus 4.8 --- Caddyfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Caddyfile b/Caddyfile index 51b6994..fd7261c 100644 --- a/Caddyfile +++ b/Caddyfile @@ -14,9 +14,13 @@ } # Runtime config: Caddy renders {{env "API_BASE"}} into env.js. Never cache it. + # `templates` only acts on text/html + text/plain by default, so JS responses + # are skipped unless their MIME type is named explicitly here. handle /env.js { - templates header Cache-Control "no-store" + templates { + mime text/javascript application/javascript + } file_server }