dragonflight/services/web-ui/nginx.conf

98 lines
3.3 KiB
Nginx Configuration File
Raw Normal View History

2026-04-07 21:58:21 -04:00
server {
listen 80;
server_name _;
# Docker embedded DNS — defers upstream resolution to request time
# This prevents nginx crashing at startup if sibling containers aren't
# ready yet (which happens on the first `docker compose up`).
resolver 127.0.0.11 valid=10s ipv6=off;
2026-04-07 22:05:41 -04:00
# Allow unlimited client upload size
client_max_body_size 0;
2026-04-07 21:58:21 -04:00
# Gzip compression
gzip on;
gzip_types text/plain text/css text/javascript application/javascript application/json;
gzip_min_length 1000;
# Root location - serve static files
root /usr/share/nginx/html;
# Fonts, icons, images: rarely change, safe to cache aggressively.
location ~* \.(png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
2026-04-07 21:58:21 -04:00
expires 1y;
add_header Cache-Control "public, immutable";
}
# CSS / JS — must revalidate so a redeploy is picked up immediately.
# The index.html links these without a version query string, so without
# this rule a stale stylesheet/script sits in the browser cache forever
# (which produced the unstyled calendar that triggered this fix).
location ~* \.(css|js)$ {
expires -1;
add_header Cache-Control "no-cache, must-revalidate";
}
2026-04-07 21:58:21 -04:00
# HTML files - no cache
location ~* \.html?$ {
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Live HLS — served from /live (bind-mounted shared volume), low cache so playlist refreshes
location /live/ {
alias /live/;
types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; }
add_header Cache-Control "no-cache";
add_header Access-Control-Allow-Origin *;
}
2026-04-07 21:58:21 -04:00
# API proxy - forward to mam-api service
location /api/ {
set $api_upstream http://mam-api:3000;
2026-04-07 22:05:41 -04:00
client_max_body_size 0;
proxy_pass $api_upstream;
2026-04-07 21:58:21 -04:00
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;
fix: close all 24 open issues (#40–#94) Bug fixes: - #91: dockerApi() 10s socket timeout (Docker daemon hang) - #77: await syncToAmpp() with .catch() — no longer fire-and-forget - #75: migration 016 — add 'proxy','import' to job_type enum; add 'completed' to job_status - #73: BullMQ orphan job cleanup on hard asset delete - #70: batch-trim jobs table gets expires_at; trim-status auto-expires stale rows - #66: scheduler tick marks stale live assets (>2h) as error - #63: migration 017 — partial unique index prevents concurrent live asset overwrite - #61: recorders.js uses getS3Bucket() not stale process.env.S3_BUCKET - #60: already fixed (copy nulls proxy/thumbnail keys, requeues proxy) - #40: already fixed (All projects clears openProject) - #64: already fixed (sourceType/needsProxy handled) - #90: GET /jobs now includes DB jobs table (trim jobs visible in UI) - #74: nginx Content-Type header preserved; multer 500MB file size limit - #68: GET /upload returns in-progress ingesting assets - #58: /stream and /video endpoints fall back to original file for all video types - #55: recorder poll .catch() logs auth errors cleanly; redirect stops interval - #52: thumb-status and thumb-duration moved inside position:relative wrapper - #50: ProjectCard gets onContextMenu handler with rename/delete menu - #49: project context menu dismisses on contextmenu + scroll events Features: - #93: POST /assets/:id/reprocess?type=proxy|thumbnail — force re-queue any asset Asset ⋯ menu now shows 'Re-generate proxy' and 'Re-generate thumbnail' buttons UI: - Logo: brightness(0) invert(1) filter applied consistently in sidebar, launcher, and login — white logo pops on dark UI; inline style removed from login.html
2026-05-26 10:10:44 -04:00
# Preserve Content-Type so multer receives the full multipart boundary (#74)
proxy_set_header Content-Type $content_type;
2026-04-07 21:58:21 -04:00
proxy_buffering off;
proxy_request_buffering off;
2026-04-07 22:05:41 -04:00
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
2026-04-07 21:58:21 -04:00
}
# Capture proxy - forward to capture service
location /capture/ {
set $capture_upstream http://capture:3001;
proxy_pass $capture_upstream;
2026-04-07 21:58:21 -04:00
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_buffering off;
proxy_request_buffering off;
}
# SPA fallback - try to serve file, else route to the React shell.
2026-04-07 21:58:21 -04:00
location / {
try_files $uri $uri/ /index.html;
2026-04-07 21:58:21 -04:00
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Deny access to dotfiles
location ~ /\. {
deny all;
}
}