70 lines
2.2 KiB
Plaintext
70 lines
2.2 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
# 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;
|
|
|
|
# CORS for API endpoints
|
|
location /api/ {
|
|
# Forward tenant ID from client
|
|
proxy_set_header X-Mandant-ID $http_x_mandant_id;
|
|
|
|
# Proxy headers
|
|
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_set_header X-Forwarded-Port $server_port;
|
|
|
|
# Disable buffering for streaming responses (Mercure)
|
|
proxy_buffering off;
|
|
|
|
# Pass to Symfony FPM
|
|
location ~ ^/api/(.+)\.php(/|$) {
|
|
fastcgi_pass symfony-fpm:9000;
|
|
fastcgi_split_path_info ^(.+.php)(/.*)$;
|
|
include fastcgi_params;
|
|
fastcgi_param SCRIPT_FILENAME /app/$fastcgi_script_name;
|
|
fastcgi_param DOCUMENT_ROOT /app;
|
|
}
|
|
|
|
# API catch-all - rewrite to index.php for Symfony routing
|
|
try_files $uri /api/index.php$is_args$args;
|
|
}
|
|
|
|
# Mercure Hub
|
|
location /.well-known/mercure {
|
|
proxy_pass https://mercure-hub/.well-known/mercure;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
# Mercure needs WebSocket support
|
|
upgrade_http 2;
|
|
}
|
|
|
|
# Static assets (frontend build output)
|
|
location /assets/ {
|
|
alias /app/public/assets/;
|
|
expires 7d;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Health check endpoint
|
|
location /api/health {
|
|
access_log off;
|
|
proxy_pass http://symfony-fpm:8000/api/health;
|
|
proxy_set_header Host localhost:8000;
|
|
}
|
|
|
|
# Frontend SPA fallback (static files served from public/)
|
|
location / {
|
|
root /app/public;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|