33 lines
1.0 KiB
Plaintext
33 lines
1.0 KiB
Plaintext
server {
|
||
listen 80;
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
# Gzip voor statische assets
|
||
gzip on;
|
||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml image/svg+xml;
|
||
|
||
# Cache-control: assets met hash in naam → lang; index.html → nooit
|
||
location ~* \.(js|css|woff2?|ttf|eot|svg|png|jpg|ico|webp)$ {
|
||
expires 1y;
|
||
add_header Cache-Control "public, immutable";
|
||
try_files $uri =404;
|
||
}
|
||
|
||
# Proxy API-calls naar de backend
|
||
location /api/ {
|
||
proxy_pass http://backend: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;
|
||
}
|
||
|
||
# SPA fallback – stuur alle routes naar index.html
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
||
}
|
||
}
|