Repository navigation
Expand file tree
/
Copy pathnginx.conf
More file actions
52 lines (47 loc) · 2.94 KB
/
Copy pathnginx.conf
File metadata and controls
52 lines (47 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
server {
listen 80;
server_name localhost;
absolute_redirect off;
server_tokens off;
root /usr/share/nginx/html;
index index.html;
# Security headers — applied to every response that nginx generates from this server.
# CSP is intentionally conservative: same-origin everything, plus data: URIs for images
# (the app stores user-uploaded images as base64 inside playbook JSON) and inline styles
# (Vue scoped styles and dynamic style attributes).
# Clickjacking protection is handled by the CSP `frame-ancestors 'none'` directive below;
# the deprecated X-Frame-Options header is therefore no longer set.
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer" always;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=(), payment=(), usb=(), interest-cohort=()" always;
add_header Content-Security-Policy "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'; font-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; form-action 'self'" always;
# Template playbooks served from mounted volume with auto-discovery.
# NOTE: autoindex is intentionally on — the template_playbooks/ folder is meant to be
# publicly listable. Do not place non-public content into the mounted volume.
location /template_playbooks/ {
alias /usr/share/nginx/html/template_playbooks/;
autoindex on;
autoindex_format json;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header X-Content-Type-Options "nosniff" always;
# This location has its own add_header block, so the server-level CSP is NOT
# inherited — set a minimal CSP here just for clickjacking protection.
add_header Content-Security-Policy "frame-ancestors 'none'" always;
add_header Referrer-Policy "no-referrer" always;
}
# Cache-busted assets (hashed filenames) — cache aggressively
location /assets/ {
add_header Cache-Control "public, max-age=31536000, immutable" always;
add_header X-Content-Type-Options "nosniff" always;
try_files $uri =404;
}
# HTML entry point — always revalidate so updates are picked up immediately
location / {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer" always;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=(), payment=(), usb=(), interest-cohort=()" always;
add_header Content-Security-Policy "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'; font-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; form-action 'self'" always;
try_files $uri $uri/ /index.html;
}
}