Files
coastal_timesheet/docker/nginx/default.conf
T
BizzleBot 70ed672381 Fix: ManageUsers component missing useAuth() - caused blank admin page
The ManageUsers sub-component referenced user?.role for conditional
role dropdown options but didn't call useAuth() to get the user object.
This caused 'user is not defined' JS errors and blank admin pages.

Browser E2E: 20/20 tests pass.
2026-02-16 20:24:34 +00:00

82 lines
2.4 KiB
Plaintext

# Coastal Timesheet — Nginx reverse proxy
# /api/* → backend:3001
# /* → frontend static files
upstream backend_api {
server backend:3004;
keepalive 16;
}
server {
listen 80;
listen [::]:80;
server_name _;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# Gzip compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 256;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/json
application/javascript
application/xml
application/rss+xml
image/svg+xml;
# Client body size (for file uploads if ever needed)
client_max_body_size 10m;
# ─── API proxy ───────────────────────────────────────
location /api/ {
proxy_pass http://backend_api;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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;
proxy_cache_bypass $http_upgrade;
# Timeouts for PDF generation / email sending
proxy_read_timeout 60s;
proxy_connect_timeout 10s;
proxy_send_timeout 30s;
}
# ─── Frontend static files ───────────────────────────
location / {
root /usr/share/nginx/html;
index index.html;
# SPA fallback — serve index.html for client-side routes
try_files $uri $uri/ /index.html;
# Cache static assets aggressively
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
}
}
# ─── Health check endpoint for load balancer ─────────
location = /nginx-health {
access_log off;
return 200 'ok';
add_header Content-Type text/plain;
}
}