Files
Scrobbler/deploy/nginx/default.conf.template
T
mattandClaude Opus 5.5 8d12922f6a
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 1m6s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
Serve fediverse paths on the UI's domain (phase 1, step 6)
- The UI container forwards /.well-known/{webfinger,nodeinfo,host-meta},
  /nodeinfo/, /users/, /inbox and /actor to API_INTERNAL_URL (compose:
  http://api:8000), passing Host and X-Forwarded-*; unset means no
  forwarding
- The API's name is resolved per request via the container's resolver,
  so the UI starts before the API and survives API restarts
- Compose passes the FEDERATION_* settings to api and worker;
  .env.example documents them, including FEDERATION_KEY_SECRET
- gunicorn: disable the 26.x control socket (the container user has no
  home directory)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-25 20:32:40 +01:00

33 lines
1.3 KiB
Plaintext

# 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:; 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";
}
}