Skip to content

Dev: J5 Connect sign-in callbacks keep their origin through Vite's proxy #1333

In review

Description

@Jacksondr5

In vp run dev, a J5 Connect sign-in callback (a join, Add sign-in, or a pairing sign-in) fails its origin check, so it never finishes through the Vite page.

Why:

  • Vite proxies /api with changeOrigin: true, because /api isn't in DEV_PROXIED_ORIGIN_PRESERVING_PREFIXES in upstream's packages/shared/src/devProxy.ts.
  • So the server sees its own port as the Host.
  • completeSignIn and completeJoin compare the callback's origin with the stored return URL, and refuse with SignInExpiredError or SignInElsewhereError.

Production serves the page and /api from one origin and isn't affected. Testers on #1258 and #1271 work around it by sending the callback straight to the API port with the original Host.

Fix (Eng Lead's call, 2026-11-30): preserve the origin for /api/j5/identity only. This is two lines, not one, because Vite uses the first proxy key that matches:

  • /api/j5/identity goes ahead of /api in DEV_PROXIED_PATH_PREFIXES;
  • and into DEV_PROXIED_ORIGIN_PRESERVING_PREFIXES.

Upstream's own /api routes are unchanged. It's an edit to an upstream file, so it needs a FORK case.

When: after wave 1's stack (#1323, #1324, #1329 and #1271's UI) merges, so it doesn't fight over FORK case numbers. Testers keep the workaround until then.

Milestone: J5 Connect (#24). Eng Lead: J5 Connect.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions