fix: Add nginx SPA routing config
All checks were successful
Deploy Development / deploy (push) Successful in 33s

This commit is contained in:
Lars 2026-04-21 16:30:11 +02:00
parent b1c5999f6e
commit e4d052f182
2 changed files with 19 additions and 2 deletions

View File

@ -25,8 +25,8 @@ FROM nginx:alpine
# Copy built app
COPY --from=build /app/dist /usr/share/nginx/html
# Copy nginx config (if exists)
# COPY nginx.conf /etc/nginx/nginx.conf
# Copy nginx config for SPA routing
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port
EXPOSE 80

17
frontend/nginx.conf Normal file
View File

@ -0,0 +1,17 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# SPA routing - serve index.html for all routes
location / {
try_files $uri $uri/ /index.html;
}
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}