- Add security headers (X-Frame-Options, X-Content-Type-Options, X-XSS-Protection) - Implement proper cache control for static assets and prevent index.html caching - Fix SSE handling to properly fetch new compression jobs - Immediately refresh job list after queuing compression for better UX feedback
48 lines
1.5 KiB
Nginx Configuration File
48 lines
1.5 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Serve static files with proper cache control
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
|
|
# Security headers for all responses
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
|
|
# No cache for index.html - always check for updates
|
|
location = /index.html {
|
|
add_header Cache-Control "private, no-cache, no-store, must-revalidate";
|
|
add_header Pragma "no-cache";
|
|
add_header Expires "0";
|
|
}
|
|
|
|
# Cache assets with hash in filename (private for single-user app)
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "private, immutable";
|
|
}
|
|
}
|
|
|
|
# Proxy API requests to backend
|
|
location /api/ {
|
|
proxy_pass http://backend:8000/api/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
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;
|
|
|
|
# Important for video streaming
|
|
proxy_buffering off;
|
|
proxy_request_buffering off;
|
|
}
|
|
}
|