All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 19m0s
80 lines
2.7 KiB
Plaintext
80 lines
2.7 KiB
Plaintext
# docker/nginx/dev.conf
|
|
# ============================================================================
|
|
# Development Nginx Configuration (HTTPS)
|
|
# ============================================================================
|
|
# This configuration matches production by using HTTPS on port 443 with
|
|
# self-signed certificates generated by mkcert. Port 80 redirects to HTTPS.
|
|
#
|
|
# This allows the dev container to work the same way as production:
|
|
# - Frontend accessible on https://localhost (port 443)
|
|
# - Backend API on http://localhost:3001
|
|
# - Port 80 redirects to HTTPS
|
|
# ============================================================================
|
|
|
|
# HTTPS Server (main)
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name localhost;
|
|
|
|
# SSL Configuration (self-signed certificates from mkcert)
|
|
ssl_certificate /app/certs/localhost.crt;
|
|
ssl_certificate_key /app/certs/localhost.key;
|
|
|
|
# Allow large file uploads (matches production)
|
|
client_max_body_size 100M;
|
|
|
|
# Proxy API requests to Express server on port 3001
|
|
location /api/ {
|
|
proxy_pass http://localhost:3001;
|
|
proxy_http_version 1.1;
|
|
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 WebSocket connections for real-time notifications
|
|
location /ws {
|
|
proxy_pass http://localhost:3001;
|
|
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 all other requests to Vite dev server on port 5173
|
|
location / {
|
|
proxy_pass http://localhost:5173;
|
|
proxy_http_version 1.1;
|
|
|
|
# WebSocket support for Hot Module Replacement (HMR)
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
|
|
# Forward real client IP
|
|
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;
|
|
}
|
|
|
|
# Security headers (matches production)
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
}
|
|
|
|
# HTTP to HTTPS Redirect (matches production)
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name localhost;
|
|
|
|
return 301 https://$host$request_uri;
|
|
}
|