mirror of
https://github.com/MrUnknownDE/bierkasten-casino.git
synced 2026-05-03 04:06:06 +02:00
45 lines
1.6 KiB
Nginx Configuration File
45 lines
1.6 KiB
Nginx Configuration File
upstream bierbaron_backend {
|
|
server backend:3000;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# --- Backend-Routen: Alle API-Pfade in einem Block zusammenfassen ---
|
|
# Dies ist sauberer und stellt sicher, dass alle die gleiche Konfiguration verwenden.
|
|
location ~ ^/(api|auth|me|wallet|slot|admin|health)/ {
|
|
proxy_pass http://bierbaron_backend;
|
|
proxy_http_version 1.1;
|
|
|
|
# Wichtige Header für die korrekte Funktionsweise hinter einem Proxy
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
# --- DIE ENTSCHEIDENDE KORREKTUR ---
|
|
# Dieser Befehl zwingt NGINX, den Cookie-Header des Clients
|
|
# explizit an das Backend weiterzuleiten.
|
|
proxy_set_header Cookie $http_cookie;
|
|
}
|
|
|
|
# --- Statisches Frontend (Single Page Application) ---
|
|
# Dieser Block fängt alle Anfragen ab, die nicht zur API gehören.
|
|
location / {
|
|
try_files $uri /index.html;
|
|
}
|
|
|
|
# Optionale Caching-Regeln für statische Assets
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|webp|woff|woff2|ttf)$ {
|
|
expires 7d;
|
|
add_header Cache-Control "public, max-age=604800, immutable";
|
|
try_files $uri =404; # Gib 404 zurück, wenn Asset nicht gefunden wird
|
|
}
|
|
} |