refactor: update API routing to use /proxy prefix for same-origin requests
This commit is contained in:
@@ -11,9 +11,15 @@ The Worker forwards each request to one of two Render services based on path:
|
||||
|
||||
| Path | Upstream |
|
||||
|---|---|
|
||||
| `/api/*` | API service (`/api` prefix stripped) |
|
||||
| `/proxy/*` | API service (`/proxy` prefix stripped, rest forwarded as-is) |
|
||||
| anything else | Dashboard service |
|
||||
|
||||
The `/proxy` prefix is the same-origin escape hatch the dashboard's
|
||||
browser code uses so its auth cookies stay host-only while still reaching
|
||||
the API. Example: a browser request to
|
||||
`https://app.classroomio.com/proxy/api/auth/sign-in/email` becomes
|
||||
`/api/auth/sign-in/email` on the API service (where Better Auth lives).
|
||||
|
||||
It preserves the original host as `X-Forwarded-Host` so:
|
||||
|
||||
- The dashboard's SvelteKit adapter-node reads it via `HOST_HEADER=x-forwarded-host` and `event.url.host` becomes the tenant/admin/BYOD host.
|
||||
|
||||
Reference in New Issue
Block a user