Add alternativeWebUrl param#956
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9e8beed19
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
EhabY
left a comment
There was a problem hiding this comment.
Nice improvement. Make sure to run pnpm format and pnpm lint:fix/pnpm typecheck!
5f34410 to
fc18726
Compare
| const prefix = browserBase.pathname.replace(/\/$/, ""); | ||
| endpoint.pathname = `${prefix}${endpoint.pathname}`; |
There was a problem hiding this comment.
This doubles the path prefix on sub-path deployments. If the connection URL has a path (e.g. https://example.com/coder), the server already returns authorization_endpoint with that prefix, so prepending browserBase.pathname yields /coder/coder/oauth2/authorize.
This is a regression: OAuth breaks on sub-path deployments even when alternativeWebUrl is unset. Stripping the connection prefix from the endpoint path before applying the UI prefix would fix it.
This PR adds a new parameter for specifying an alternative URL to use when opening Coder pages in the browser. When set, it replaces the connection URL for browser links only (dashboard, workspace pages, token authentication page). The connection URL is still used for API calls, SSH, and CLI operations. Useful when the Coder API runs on a port that browsers restrict (e.g., 7004) but the web UI is accessible on a standard port (e.g., 443)."