From 83518e2b3e473d5ca40a3bd6d07473f798e73beb Mon Sep 17 00:00:00 2001 From: Jonas Hinterdorfer Date: Thu, 10 Jul 2025 19:38:35 +0200 Subject: [PATCH] fix redirect bug --- Dockerfile | 3 ++- nginx.conf | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index 90deddc..739d85f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,5 +9,6 @@ RUN npm run build # Production stage FROM nginx:alpine COPY --from=build /app/build /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..14af989 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,19 @@ +# nginx.conf +server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri /index.html; + } + + # Optional: serve static files directly + location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|woff2?|ttf|eot|otf|ttc|json)$ { + try_files $uri =404; + access_log off; + add_header Cache-Control "public, max-age=31536000, immutable"; + } +}