Files
private_image/nginx/snippets/private-image-locations.conf.template
T
nobswebdev b97fcc2b20 Add CSP sandbox on nginx hotlink image responses.
Block script in user content when /i/ is opened as a document, e.g. SVG opened in a tab.
2026-10-28 22:38:28 +01:00

50 lines
1.3 KiB
Plaintext

location ^~ /i/ {
add_header Content-Security-Policy "sandbox" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Cross-Origin-Resource-Policy "cross-origin" always;
add_header Cache-Control "private, no-store" always;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://backend:${BACKEND_PORT};
}
location /api {
client_max_body_size ${UPLOAD_MAX_REQUEST_BODY_BYTES};
add_header Cache-Control "no-store" always;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
proxy_pass http://backend:${BACKEND_PORT};
}
location /pgadmin {
proxy_set_header X-Script-Name /pgadmin;
proxy_set_header Host $host;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie;
proxy_pass http://pgadmin;
proxy_redirect off;
}
location / {
add_header Referrer-Policy "no-referrer" always;
add_header Cache-Control "no-store" always;
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}