Fix serving issue: remove index.txt and add explicit root route

- Remove .txt files from build output that caused download prompts
- Add explicit location = / rule to ensure index.html is served

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-02-16 19:43:56 +00:00
parent 369ce58f40
commit 86898d7c2f
2 changed files with 6 additions and 1 deletions

View File

@ -8,5 +8,6 @@ RUN npm run build
FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/out /usr/share/nginx/html
RUN rm -f /usr/share/nginx/html/*.txt
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -17,7 +17,11 @@ server {
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# Handle Next.js static export routes
# Serve index.html for root and all routes (SPA fallback)
location = / {
try_files /index.html =404;
}
location / {
try_files $uri $uri.html $uri/index.html /index.html;
}