fix(dashboard): rewrite proxied OAuth redirects to public origin - #376
Draft
M-DGayle wants to merge 1 commit into
Draft
fix(dashboard): rewrite proxied OAuth redirects to public origin#376M-DGayle wants to merge 1 commit into
M-DGayle wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Locationresponses from the private dashboard API upstream to the configured public OpenShip originRoot cause
The same-host dashboard proxy streamed upstream response headers verbatim. During MCP OAuth, Better Auth adds
prompt=consentby redirecting back to the authorize endpoint using the API request's internal origin (http://127.0.0.1:4000). A remote browser therefore followed the private VM address and failed before the consent page could load.Impact
External MCP clients such as Codex can complete OAuth against a self-hosted OpenShip instance served through the dashboard proxy. The API and dashboard may remain bound to loopback; this change does not require opening another port or weakening authentication.
Validation
Location: http://127.0.0.1:4000/...codex mcp login openship;codex mcp listreports the server asOAuthbun run --cwd apps/dashboard test— 123 tests passedbunx tsc --noEmit -p apps/dashboard/tsconfig.json— passedbunx prettier --check ...for all changed files — passedNEXT_PUBLIC_API_PROXY=true INTERNAL_API_URL=http://127.0.0.1:4000 OPENSHIP_PUBLIC_URL=https://ops.example.com bun run --cwd apps/dashboard build— passedThe repository's current
bun run --cwd apps/dashboard lintcommand was also attempted, but Next 16 interpretsnext lintas a project-directory argument and exits withInvalid project directory .../apps/dashboard/lint. The TypeScript check and production build both pass.Exclusions
Risk
The rewrite applies only when the upstream
Locationresolves to the same origin as the configured private API upstream. Redirects to a Codex/Claude loopback callback or any other external origin are preserved byte-for-byte.Related to #346 and #119.