Files
Galena/netlify.toml

48 lines
2.9 KiB
TOML

# Netlify hosts ONLY Galena's static console (the frontend/ folder).
#
# Galena's backend — FastAPI + PostgreSQL + on-disk git repositories + a long-lived process with an
# in-process per-repo write lock — CANNOT run on Netlify's static + serverless model. Run the backend
# the documented way (`docker compose up -d --build` on a server/VM — see README), then set these in
# this Netlify site's environment variables:
#
# GALENA_BACKEND_URL = https://your-galena-backend.example.com # /api/v1/* + /healthz proxy here
# GALENA_PUBLIC_URL = https://your-netlify-site.netlify.app # optional; link-preview base URL
#
# and, on the BACKEND (its .env, not here), list this site's origin as a trusted one:
#
# CORS_ALLOW_ORIGINS = https://your-netlify-site.netlify.app
#
# Netlify's proxy sends the backend its own Host, so the browser's Origin (this site) names another
# host, and the backend's cross-site write guard refuses sign-in and cookie writes unless it is listed.
#
# With both set, the console works end-to-end (Netlify proxies the API to your backend).
# Without GALENA_BACKEND_URL, the console still BUILDS and loads, but every API call returns 404 (there's no backend).
# This is a front-door deployment, not a way to run Galena's server on Netlify.
# The document viewer shell (frontend/static/readerjs/reader.html) is served here AS-IS, so it loads
# ReaderJS from the default pinned in its <meta name="readerjs-base">; READERJS_BASE_URL only applies
# where the backend serves the console.
[build]
publish = "frontend"
command = "bash netlify/prepare.sh"
# Roughly mirror the backend's own hardening (app/edge.py) (the strict CSP + /raw rules live in the backend).
[[headers]]
for = "/*"
[headers.values]
X-Content-Type-Options = "nosniff"
# SAMEORIGIN, not DENY: the ReaderJS document viewer runs in a same-origin <iframe> embedded by the
# console (frontend/static/readerjs/reader.html). DENY blocks ALL framing — including the console
# framing its own viewer — so the viewer stays blank on Netlify (it works locally only because a
# plain http.server sends no such header). SAMEORIGIN still blocks cross-origin (clickjacking)
# framing, which is the real protection. Applied site-wide rather than scoped to /static/readerjs/*
# — broader than the backend, which keeps DENY everywhere and grants SAMEORIGIN only to
# /static/readerjs/* (see _READER_CSP in backend/app/main.py) — because Netlify *merges* (not
# overrides) a repeated header across matching [[headers]] rules, so a path-scoped SAMEORIGIN layered
# over a global DENY can emit BOTH values and browsers fall back to the stricter DENY, re-blanking the
# viewer. One site-wide SAMEORIGIN sidesteps that and is still safe here (the only same-origin page
# that could frame the console is the console itself).
X-Frame-Options = "SAMEORIGIN"
Referrer-Policy = "strict-origin-when-cross-origin"