Skip to content

fix(dashboard): route canonical GitHub OAuth endpoint through proxy - #1686

Closed
zbzailabs wants to merge 1 commit into
oblien:mainfrom
zbzailabs:codex/fix-github-oauth-redirect
Closed

zbzailabs wants to merge 1 commit into
oblien:mainfrom
zbzailabs:codex/fix-github-oauth-redirect

Conversation

@zbzailabs

Copy link
Copy Markdown

Summary

Route the canonical GitHub OAuth navigation endpoint through the existing dashboard API proxy in same-origin builds.

/api/github/connect/redirect?install_state=...
  -> /api/proxy/api/github/connect/redirect?install_state=...

Motivation

In a self-hosted proxy deployment, the API implements this endpoint but the canonical dashboard-origin URL returns 404. Normal UI navigation already resolves relative URLs to the proxy; this change covers the canonical endpoint and does not claim every UI flow is broken.

Related issue

Closes #1685

Changes

  • Add one exact dashboard rewrite, only when NEXT_PUBLIC_API_PROXY=true.
  • Test query preservation and verify that proxy-disabled builds add no rewrite.

Verification

  • Before the change, the new Next.js config regression test failed for proxy mode and passed with the proxy disabled. After the change, it passes in both modes.
  • ./node_modules/.bin/vitest run --config apps/dashboard/vitest.config.ts apps/dashboard/src/lib/github-oauth-route.test.ts apps/dashboard/src/lib/framing-protection.test.ts apps/dashboard/src/lib/api/urls.test.ts: 3 files, 18 tests passed, using isolated dependencies on Node 26.
  • Separately, a 0.9.11 image with the equivalent rewrite was built for Linux amd64 and tested against a mock API: a request with an install_state query and mock session cookie returned the mock 302 Location and both Set-Cookie headers; /api/auth still forwarded. This was not a test of the PR's current main SHA or a real GitHub authorization.
  • The full repository test suite, dashboard typecheck, and repository-wide format have not been run. A scoped Prettier check identified an existing unrelated formatting difference in next.config.mjs; it was left untouched.

Merge danger

Two-way: the exact rewrite can be reverted independently. Scope: same-origin dashboard builds. No new API endpoint or new auth bypass is introduced; the target is the existing API proxy.

Checklist

  • One focused change
  • A regression test fails before and passes after
  • Full test suite, dashboard lint and repository-wide format pass locally

@Hydralerne

Copy link
Copy Markdown
Member

Superseded by #1723. The replacement retains this focused exact rewrite and adds current-checkout regression tests, real HTTP proxy coverage, and a running Next.js smoke check in both proxy modes.

@Hydralerne Hydralerne closed this Nov 11, 2026
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.

[Bug] Canonical GitHub authorization endpoint returns 404 in same-origin proxy mode

2 participants