Repository navigation
Expand file tree
/
Copy pathnetlify.toml
More file actions
55 lines (47 loc) · 1.92 KB
/
Copy pathnetlify.toml
File metadata and controls
55 lines (47 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Netlify configuration for the Overup frontend.
# Full guide: docs/deploy-frontend-netlify.md
#
# The API and the auth flow are PROXIED (status = 200 rewrites) to the
# backend so the HttpOnly session cookie stays first-party on this site's
# origin — cross-site cookies are blocked by modern browsers, so pointing
# the SPA directly at the API origin would break login everywhere.
#
# Netlify's proxy cannot forward WebSocket upgrades, so sockets connect
# DIRECTLY to the API origin (REACT_APP_WS_ORIGIN below). The session cookie
# can't ride that cross-origin upgrade; instead the app mints a one-time
# 60-second ticket over the proxied REST API (cookie + CSRF + RBAC apply)
# and presents it as ?ticket= on the upgrade. REST polling remains the
# fallback while a socket is down. Requires the backend to run with
# FRONTEND_URL set to exactly this site's origin (the WS Origin allow-list).
[build]
command = "npm run build"
publish = "build"
[build.environment]
# Same-origin: XHR stays relative and flows through the redirects below.
REACT_APP_API_ORIGIN = ""
# Direct WebSocket origin (see the ticket note above).
REACT_APP_WS_ORIGIN = "https://overup-api.duckdns.org"
# --- Backend proxy (order matters: most specific first) ----------------------
[[redirects]]
from = "/api/*"
to = "https://overup-api.duckdns.org/api/:splat"
status = 200
force = true
# Covers /auth/github/login, /auth/github/callback, /auth/github/app/setup.
# Deliberately NOT /auth/* — /auth/callback is a React route handled by the
# SPA fallback below.
[[redirects]]
from = "/auth/github/*"
to = "https://overup-api.duckdns.org/auth/github/:splat"
status = 200
force = true
[[redirects]]
from = "/auth/logout"
to = "https://overup-api.duckdns.org/auth/logout"
status = 200
force = true
# --- SPA fallback -------------------------------------------------------------
[[redirects]]
from = "/*"
to = "/index.html"
status = 200