diff --git a/src/hospitality-web/Dockerfile b/src/hospitality-web/Dockerfile index 1b2b467..258f91e 100644 --- a/src/hospitality-web/Dockerfile +++ b/src/hospitality-web/Dockerfile @@ -22,5 +22,8 @@ WORKDIR /usr/share/nginx/html # Legg inn bygget frontend COPY --from=build /app/dist . +# Kopier custom nginx config for SPA routing +COPY nginx.conf /etc/nginx/conf.d/default.conf + # Nginx server som statisk side EXPOSE 80 diff --git a/src/hospitality-web/nginx.conf b/src/hospitality-web/nginx.conf new file mode 100644 index 0000000..c810bd3 --- /dev/null +++ b/src/hospitality-web/nginx.conf @@ -0,0 +1,17 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + # Support for SPA routing + location / { + try_files $uri $uri/ /index.html; + } + + # Optional: Cache static assets + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { + expires 1y; + add_header Cache-Control "public, no-transform"; + } +}