From 0083d672727b0a0ad914d368a03f0bb28e2d5692 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sat, 27 Jun 2026 00:43:45 +1000 Subject: [PATCH] fix: nginx config for UI serving under base path (#61) Vite's \`base: /ui\` makes HTML reference \`/ui/assets/...\` but files are at \`/usr/share/nginx/html/assets/\` (no \`ui/\` subdir). The previous \`location /ui { try_files ... }\` couldn't find the files. Fix: rewrite strips the base path prefix before try_files, so \`/ui/assets/foo.js\` resolves to \`/usr/share/nginx/html/assets/foo.js\`. Reviewed-on: https://git.unkin.net/unkin/artifactapi/pulls/61 Co-authored-by: Ben Vincent Co-committed-by: Ben Vincent --- ui/nginx.conf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/nginx.conf b/ui/nginx.conf index 7a49804..be8615b 100644 --- a/ui/nginx.conf +++ b/ui/nginx.conf @@ -5,7 +5,12 @@ server { root /usr/share/nginx/html; index index.html; - location ${BASE_PATH} { + location ${BASE_PATH}/ { + rewrite ^${BASE_PATH}(/.*)$ $1 break; try_files $uri $uri/ /index.html; } + + location = ${BASE_PATH} { + return 301 ${BASE_PATH}/; + } }