Skip to content

feat(frontend-plus-api): inter-app service discovery + server-side proxy#15

Open
jona62 wants to merge 2 commits into
mainfrom
feat/frontend-plus-api-service-discovery
Open

feat(frontend-plus-api): inter-app service discovery + server-side proxy#15
jona62 wants to merge 2 commits into
mainfrom
feat/frontend-plus-api-service-discovery

Conversation

@jona62
Copy link
Copy Markdown
Contributor

@jona62 jona62 commented May 30, 2026

Reworks the example to use the new platform inter-app networking:

  • frontend-web proxies /api to its sibling over loopback using RIGBOX_FRONTEND_API_URL, which the platform injects from dependsOn: [frontend-api] (localhost fallback keeps node server.js working in local dev).
  • Browser stays same-origin → no CORS; frontend-api stays private (the default). Only frontend-web is shared public.
  • Replaces the old cross-origin browser fetch that failed with CORS request did not succeed against the private API.

Verified live end-to-end: frontend-web/api/todos → 200 (proxied over loopback) while frontend-api direct subdomain → 302 (private).

Note: full platform injection requires CLI ≥ 0.12.33 (sends run.dependsOn); on older CLIs the server.js localhost fallback keeps the demo working.

jona62 added 2 commits May 30, 2026 18:33
…e proxy

frontend-web now proxies /api to its sibling over loopback using the
RIGBOX_FRONTEND_API_URL the platform injects from `dependsOn: [frontend-api]`
(localhost fallback for local dev). The browser stays same-origin, so the
API needs no CORS and frontend-api stays private — only frontend-web is
shared public. Replaces the old cross-origin browser fetch that failed with
"CORS request did not succeed" against the private API.
The page now toggles how server.js reaches the backend:
- Private (default): proxy /api over the VM loopback (no creds, unmetered).
- Internet: proxy /api to frontend-api's PUBLIC subdomain, authenticated
  server-side with X-Rigbox-Key from an optional RIGBOX_API_KEY deploy
  secret — exercising the public/metered path while the API stays private.

The key is an optional secret (`secrets: [{ name: RIGBOX_API_KEY, optional:
true }]`), so deploy succeeds with or without it; when unset the toggle shows
a toast with instructions and the app stays on the loopback route. The key
never reaches the browser. README documents the toggle, the owner-key
requirement, the workspace-scoped-key recommendation, and the
`rig app share --public` keyless alternative. Requires CLI >= 0.12.33.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant