From e11f91e14da3f1ab183a95eb9de131cc8e093714 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Wed, 1 Apr 2026 17:06:59 -0700 Subject: [PATCH] fix: nginx /kiwi/ alias for direct port access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vite builds with VITE_BASE_URL=/kiwi so assets are referenced as /kiwi/assets/... in index.html. When accessed via Caddy at the /kiwi path, Caddy strips the prefix and nginx gets /assets/... correctly. When accessed directly at localhost:8515, nginx had no /kiwi/ route so the JS/CSS 404'd and the SPA never booted (blank page on hard refresh). Add location ^~ /kiwi/ { alias ...; } — ^~ prevents the regex \.(js|css|...)$ location from intercepting /kiwi/ paths first. --- docker/web/nginx.cloud.conf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker/web/nginx.cloud.conf b/docker/web/nginx.cloud.conf index dcd5bc9..3cc81b3 100644 --- a/docker/web/nginx.cloud.conf +++ b/docker/web/nginx.cloud.conf @@ -18,6 +18,15 @@ server { client_max_body_size 20m; } + # When accessed directly (localhost:8515) instead of via Caddy (/kiwi path-strip), + # Vite's /kiwi base URL means assets are requested at /kiwi/assets/... but stored + # at /assets/... in nginx's root. Alias /kiwi/ → root so direct port access works. + # ^~ prevents regex locations from overriding this prefix match for /kiwi/ paths. + location ^~ /kiwi/ { + alias /usr/share/nginx/html/; + try_files $uri $uri/ /index.html; + } + location = /index.html { add_header Cache-Control "no-cache, no-store, must-revalidate"; try_files $uri /index.html;