mirror of
https://github.com/MrUnknownDE/bierkasten-casino.git
synced 2026-04-24 00:43:43 +02:00
54 lines
1.6 KiB
Nginx Configuration File
54 lines
1.6 KiB
Nginx Configuration File
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
|
|
default $scheme;
|
|
https https;
|
|
}
|
|
|
|
upstream bierbaron_backend {
|
|
server backend:3000;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# --- WebSocket-Route ---
|
|
# Dieser Block fängt Anfragen an /ws ab und leitet sie mit den
|
|
# nötigen Headern für eine WebSocket-Verbindung weiter.
|
|
location /ws {
|
|
proxy_pass http://bierbaron_backend;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
# --- API-Routen (HTTP) ---
|
|
location ~ ^/(api|auth|me|wallet|slot|admin|health)($|/) {
|
|
proxy_pass http://bierbaron_backend;
|
|
proxy_http_version 1.1;
|
|
|
|
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 $proxy_x_forwarded_proto;
|
|
proxy_set_header Cookie $http_cookie;
|
|
}
|
|
|
|
# --- Statisches Frontend (Single Page Application) ---
|
|
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;
|
|
}
|
|
} |