fix(gateway): proxy browser server functions to workspace apps
Quality / quality (ubuntu-latest) (push) Failing after 10m40s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-18 23:30:42 +05:30
parent 701acd828c
commit 03d5cb6aa6
4 changed files with 63 additions and 16 deletions
+4 -4
View File
@@ -27,10 +27,10 @@ function parseOriginMap(value: string | undefined): Record<string, string> {
*
* Prefer `WRNEXUS_INTERNAL_ORIGINS` (loopback origins the gateway hands each
* child before spawning it) over `appOrigin`, which resolves the app's
* PUBLIC origin. The public origin is the wrong target for RPC: the gateway
* unconditionally 404s the reserved `/__wrnexus/rpc` prefix on anything that
* arrives at a public origin — that block is the whole point, it is what
* keeps inter-app calls off the public internet. Falling back to `appOrigin`
* PUBLIC origin. The public origin is the wrong target for inter-app RPC: the
* gateway 404s private `/__wrnexus/rpc/<service>/<procedure>` routes. (The
* exact prefix remains the CSRF-protected browser server-function endpoint.)
* That block keeps inter-app calls off the public internet. Falling back to `appOrigin`
* when no internal-origin map is present keeps single-app and test setups
* (which only set `WRNEXUS_WORKSPACE_ORIGINS`) working.
*/
+2 -2
View File
@@ -184,8 +184,8 @@ describe("RPC integration", () => {
const originalInternal = process.env.WRNEXUS_INTERNAL_ORIGINS;
try {
// The workspace (public) origin deliberately points somewhere that
// cannot serve the RPC — the gateway 404s the RPC prefix on any
// request that arrives at a public origin. Only the internal-origin
// cannot serve the RPC — the gateway 404s private nested RPC routes
// that arrive at a public origin. Only the internal-origin
// map points at the real server. If httpTransport() ever falls back
// to the public origin by default again, this call fails.
process.env.WRNEXUS_WORKSPACE_ORIGINS = JSON.stringify({