Files
project_vollidioten_website/nginx.conf
Lars Behrends d3d7ec46e6 feat: Add DatabaseManager and LinkPlayer components, implement authentication and linking logic
- Created DatabaseManager component for managing database access via phpMyAdmin.
- Developed LinkPlayer component to link Discord accounts with game characters, including user authentication and error handling.
- Added mock data files for players, organizations, and projects to handle backend unavailability.
- Implemented AuthService for managing user authentication and session checks.
- Created DatabaseService to fetch and manage player, organization, and project data with fallback to mock data.
- Added HTML page for handling authentication unavailability.
- Developed a test script for validating Docker setup and required files.
2025-12-28 16:46:04 +01:00

51 lines
1.4 KiB
Nginx Configuration File

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /api/ {
# Try to proxy to backend first
proxy_pass http://backend:3000;
proxy_set_header Host $host;
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;
# If backend is unavailable, serve mock data
error_page 502 503 504 = @fallback;
}
location @fallback {
# Serve mock data from frontend
rewrite ^/api/(.*)$ /mock/$1 break;
try_files $uri /index.html;
# Add header to indicate mock data is being used
add_header X-Mock-Data "true";
add_header X-Backend-Status "unavailable";
}
# Handle auth endpoints
location /auth/ {
proxy_pass http://backend:3000;
proxy_set_header Host $host;
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;
# Auth endpoints should fail if backend is down
error_page 502 503 504 = /auth-unavailable.html;
}
# Handle static assets
location /assets/ {
expires 1y;
add_header Cache-Control "public";
}
}