The platform is dropping Caddy (Atrium's backend becomes the front door and
forwards /sygna/* with the prefix stripped), and the standalone stack drops
it too, so the backend now answers for everything Caddy added.
- app/edge.py: SecurityHeaders, pure ASGI and outermost, sets the full
set on every response, errors included: nosniff, Referrer-Policy
same-origin (the family's value), COOP same-origin, X-Frame-Options DENY
or SAMEORIGIN, and on the console Caddy's CSP (frame-ancestors from
FRAME_ANCESTORS) plus no-cache. The CSP stays console-only, as Caddy had
it: on the API it would break the Swagger UI at /api/v1/docs.
- FRAME_ANCESTORS is 'none' (default) or 'self'; anything else refuses to
start.
- SpaStaticFiles is try_files {path} /index.html; ConsoleUnlessApi keeps
everything under /api and /healthz off the console (404 or 405 with
Allow), comparing route paths.
- BodySizeLimit caps a request at 100 MB; GZipMiddleware; /healthz answers
HEAD too.
- Dockerfile: frontend as a named build context; uvicorn with
--proxy-headers, --forwarded-allow-ips and --no-server-header.
- Standalone compose publishes the backend on :80; Caddyfile deleted;
deploy_check and compose-smoke check the new shape.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
2.6 KiB
TOML
47 lines
2.6 KiB
TOML
# Netlify hosts ONLY Sygna's static console (the frontend/ folder).
|
|
#
|
|
# Sygna's backend — FastAPI + PostgreSQL, a long-lived process with an in-process reminder
|
|
# scheduler and a backup scheduler — CANNOT run on Netlify's static + serverless model. Run it the
|
|
# documented way (`docker compose up -d --build` on a server or VM, see README), then set these in
|
|
# this Netlify site's environment variables:
|
|
#
|
|
# SYGNA_BACKEND_URL = https://sygna-backend.kancelaria.example # /api/v1/* + /healthz proxy here
|
|
#
|
|
# and, on the BACKEND, CORS_ALLOW_ORIGINS = https://<this-site>.netlify.app. Netlify's proxy
|
|
# replaces Host with the backend's, so without that entry the cross-site write guard
|
|
# (backend/app/deps.py) sees a foreign Origin and refuses login and every cookie write.
|
|
#
|
|
# With SYGNA_BACKEND_URL set, the console works end-to-end (Netlify proxies the API to your
|
|
# backend). Without it, the build injects frontend/demo.js and the console runs entirely in the
|
|
# browser against invented data — which is what makes this URL something you can send to somebody.
|
|
# Set SYGNA_DEMO=0 to get a bare console with neither backend nor mock.
|
|
#
|
|
# This is a front door, not a way to run Sygna's server on Netlify. In particular: a real firm's
|
|
# deployment keeps the console on the SAME origin as its API, served by its own backend, because everything
|
|
# in Sygna is privileged material and a proxy in front of it is one more place that sees it.
|
|
|
|
[build]
|
|
publish = "frontend"
|
|
command = "bash netlify/prepare.sh"
|
|
|
|
# Roughly mirrors the backend's own hardening; the strict CSP lives in the backend (app/edge.py).
|
|
[[headers]]
|
|
for = "/*"
|
|
[headers.values]
|
|
X-Content-Type-Options = "nosniff"
|
|
# DENY, not SAMEORIGIN: nothing may frame Sygna's console. This differs from Galena's Netlify
|
|
# config, which needs SAMEORIGIN because its ReaderJS viewer runs in a same-origin iframe.
|
|
# Sygna frames GALENA (the Akta tab, controlled by frame-src — who Sygna may embed); no page
|
|
# ever frames Sygna, and the demo has no case file to show anyway.
|
|
X-Frame-Options = "DENY"
|
|
Referrer-Policy = "same-origin"
|
|
# The console loads nothing from a CDN — the same rule the real deployment enforces — so the
|
|
# demo cannot quietly acquire a third-party dependency that the Docker build would then lack.
|
|
Content-Security-Policy = "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'"
|
|
|
|
# The demo invents its own data and is not a page anyone should find in a search result.
|
|
[[headers]]
|
|
for = "/*"
|
|
[headers.values]
|
|
X-Robots-Tag = "noindex"
|