diff --git a/frontend/nginx.conf b/frontend/nginx.conf index fe6e822..d78f813 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -5,13 +5,8 @@ server { root /usr/share/nginx/html; index index.html; - # App-Route - location / { - try_files $uri /index.html; - } - - # API → Intern weiterleiten an Express - location /api/ { + # API wird intern an Express weitergereicht + location ^~ /api/ { proxy_pass http://backend:3000/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; @@ -20,7 +15,12 @@ server { proxy_cache_bypass $http_upgrade; } - # Static Files + # Alle anderen Requests an index.html (für React-Routing) + location / { + try_files $uri /index.html; + } + + # Static Files explizit behandeln (optional) location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|ttf|svg|eot|otf)$ { expires 6M; access_log off;