Repository navigation
docs: reverse-proxy setup for the scene API - #880
chbndrhnns wants to merge 1 commit into
Conversation
|
I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…). Please try again, rephrase, or reach out if it keeps failing. Error id: 5fd6ce60-1278-45c6-9c6c-9d3c5be88917 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 432381e. Configure here.
|
Verified this patch on a self-hosted deployment behind a Cloudflare Tunnel (no token, host is not loopback):
One deployment note from testing: both the Thanks for the fix — it unblocked our deployment. |
Aymericr
left a comment
There was a problem hiding this comment.
Thanks for the clear repro, @chbndrhnns — the proxy 503 is a real problem for self-hosters. I can't merge this as is, though, because it opens an auth bypass:
OriginandX-Forwarded-Hostare both client-controlled. WhenPASCAL_SCENE_API_TOKENis unset, any non-browser client can sendOrigin: https://pascal.example.complus a matchingX-Forwarded-Hostand get full create/update/delete on the scene API. That's the same concern as Bugbot's high-severity finding — the follow-up commit fixed the parsing, but the trust problem is still there.- Forwarded headers should only be honored behind an explicit opt-in (e.g. a
PASCAL_TRUST_PROXY=1env var), and even then I'd rather keep a configured token as the only non-loopback auth path. The simplest fix for your setup may be docs: setPASCAL_SCENE_API_TOKENand have the proxy inject the header. - Please also rebase onto current
main.
Happy to re-review once it's reworked along those lines.
9e7bad6 to
c5b3eae
Compare
|
Thanks @Aymericr. Rebased onto current Following your feedback and the recent commit
|
Aymericr
left a comment
There was a problem hiding this comment.
Thanks @chbndrhnns, dropping the header-based bypass and going docs-only is exactly the right call, and I checked that PASCAL_SCENE_API_ORIGINS and the X-Pascal-Scene-Token header both exist in apps/editor/lib/scene-api-security.ts. Two small things before this can go in:
- The
PASCAL_AUTH=proxysentence inSETUP.mdis a bit misleading. It says/api/scenesis "open to authenticated browser sessions", but in proxy mode there's no Pascal session at all:resolveAuthModereturnsopen, so with noPASCAL_SCENE_API_TOKENset the scene API accepts every request that reaches the app. Could you reword it to something like "in that mode/api/scenesaccepts every request that reaches Pascal, so make sure the app is only reachable through the proxy"? It's also worth one line sayingPASCAL_AUTH=proxyis ignored whenPASCAL_ADMIN_PASSWORDis set, since the password wins inresolveAuthMode. - Title and description. The PR is now a docs change, so please retitle it (e.g.
docs: reverse-proxy setup for the scene API) and update the description so it matches what actually lands.
Happy to merge once those are in.
c5b3eae to
1869335
Compare
|
Thanks @Aymericr! Updated:
|
Aymericr
left a comment
There was a problem hiding this comment.
Thanks @chbndrhnns, both of my points are in and the wording reads well now. One last thing before I merge: the rebase seems to have dropped two lines from the "Loopback stays open" bullet in SETUP.md. It now ends mid-sentence at "reached at", and the note about setting PASCAL_ADMIN_PASSWORD when you open a dev server to your LAN is gone. Could you restore those two lines as they are on main? Once that's back I'll merge.
| If you protect the scene API with `PASCAL_SCENE_API_TOKEN` behind a proxy, configure your | ||
| reverse proxy to inject `Authorization: Bearer <token>` or `X-Pascal-Scene-Token: <token>` | ||
| on forwarded requests to `/api/scenes`. | ||
| - **Loopback stays open.** `bun dev`, the CLI's managed editor and `docker run` reached at |
There was a problem hiding this comment.
This bullet now stops at "reached at". Please restore the two lines that were removed here:
`localhost` need no password. Opening a dev server to another device on your LAN counts
as a network host: set `PASCAL_ADMIN_PASSWORD` in `.env.local` for that.
1869335 to
c1a155f
Compare
|
Good catch! Restored those two lines to the "Loopback stays open" bullet in - **Loopback stays open.** `bun dev`, the CLI's managed editor and `docker run` reached at
`localhost` need no password. Opening a dev server to another device on your LAN counts
as a network host: set `PASCAL_ADMIN_PASSWORD` in `.env.local` for that.Amended and force-pushed. Thank you for the review! |
Aymericr
left a comment
There was a problem hiding this comment.
Thanks @chbndrhnns, the "Loopback stays open" lines are back exactly as on main, and everything from the earlier rounds is in. Docs look good to me. CI on forks needs a maintainer to approve the workflow run, so this will go in once that's done.

Summary
Documents reverse-proxy deployment configurations for self-hosted instances calling
/api/scenes.Details
PASCAL_AUTH=proxy: when configured,/api/scenesaccepts requests that reach Pascal without requiring an in-app session (meaning the app must be protected at the proxy level).PASCAL_AUTH=proxyis ignored whenPASCAL_ADMIN_PASSWORDis configured, as password authentication takes precedence inresolveAuthMode./api/sceneswithPASCAL_SCENE_API_TOKENbehind a reverse proxy, the proxy should injectAuthorization: Bearer <token>orX-Pascal-Scene-Token: <token>on forwarded requests.PASCAL_SCENE_API_ORIGINSfor CORS configuration.Note
Low Risk
Comments and setup guide only; no application or auth logic changes.
Overview
Documentation-only update for self-hosted reverse-proxy and scene API setup in
.env.exampleandSETUP.md..env.exampleadds commented guidance for proxy-injected scene API auth (AuthorizationorX-Pascal-Scene-Token),PASCAL_AUTH=proxy(with a note that it is ignored whenPASCAL_ADMIN_PASSWORDis set), andPASCAL_SCENE_API_ORIGINSfor CORS.SETUP.mdexpands the env table and the self-hosting “Fail closed” section: in proxy mode/api/scenestrusts requests that reach the app (so exposure must be limited to the proxy), password auth wins over proxy mode, and proxies should inject the scene bearer whenPASCAL_SCENE_API_TOKENis used.Reviewed by Cursor Bugbot for commit c1a155f. Bugbot is set up for automated code reviews on this repo. Configure here.