# Rendered by the nginx image's envsubst step (API_BASE_URL comes from the environment). # Behind a TLS proxy, keep its scheme; otherwise use ours. map $http_x_forwarded_proto $scrobbler_forwarded_proto { default $http_x_forwarded_proto; "" $scheme; } server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; server_tokens off; # add_header isn't inherited by locations that set their own, so the security # headers live in the location that serves pages. location / { try_files $uri $uri/ =404; # Files aren't fingerprinted, so always revalidate. add_header Cache-Control "no-cache"; add_header Content-Security-Policy "default-src 'self'; connect-src 'self' ${API_BASE_URL}; img-src 'self' data: blob:; style-src 'self'; font-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'" always; add_header X-Content-Type-Options nosniff always; add_header Referrer-Policy same-origin always; } # Fediverse paths forwarded to the API (written at start-up; empty if API_INTERNAL_URL is unset). include /etc/nginx/scrobbler/federation.conf; location /fonts/ { add_header Cache-Control "public, max-age=2592000, immutable"; } }