Repository navigation
feat: add URL-prefix support to OpenCode Web (even behind prefix-stripping reverse proxies) - #47977
fromelicks wants to merge 35 commits into
Conversation
…enzi/opencode into feat/base-path-support
# Conflicts: # packages/opencode/src/server/routes/instance/httpapi/server.ts # packages/opencode/src/server/server.ts
…enzi/opencode into feat/base-path-support
# Conflicts: # packages/opencode/src/server/routes/instance/httpapi/server.ts
# Conflicts: # packages/app/src/env.d.ts
…t/base-path-support
…t/base-path-support
The v1 generated client used new URL(descriptor.path, options.baseUrl) which drops the path component of baseUrl when descriptor.path is absolute. This caused all v1 client API requests to miss the --base-path prefix, breaking reverse proxy deployments. Fix: use string concatenation (baseUrl + path) instead of new URL(path, baseUrl), matching the v2 SDK approach. Also fixes server-protocol.ts which had the same new URL() pattern. Added test: 'preserves base path in request URLs'
Merge anomalyco#28326 and fabiovincenzi#1, retaining their commit history. Exclude the unrelated models.json snapshot.
Port anomalyco#47442 onto dev, including generated and vendored clients, raw CLI requests, and terminal URLs. Support proxies that remove the public URL prefix and complete assets, PWA, deep-link, tab, and session-path handling. Validate client generation and archive reproducibility, server/client/app regressions, real HTTP listeners and PTYs, package typechecks, standalone builds, and browser navigation through a reverse proxy.
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found that PR #47977 (the current PR) is a merge of three existing PRs. The PR description itself explicitly mentions it closes:
The search results show that PR #47442 and PR #28326 are directly related and are mentioned as being merged into the current PR #47977. These are not duplicates in the traditional sense—the current PR #47977 is intentionally consolidating these related PRs together, as stated in the description: "This a merge of three PRs." No other open duplicate PRs found that haven't already been acknowledged and merged into PR #47977. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Are there any updates on this PR? It'd be great to have this branch merged |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #7624, closes #28326, closes fabiovincenzi#1, closes #46498, closes #47442.
This a merge of three PRs: #28326, fabiovincenzi#1 and #47442. I made it for myself.
Type of change
What does this PR do?
Adds URL-prefix support to OpenCode Web behind reverse proxies that preserve or strip the prefix. Keeps assets, API/SSE requests, terminal WebSockets, and session/tab navigation under the configured path, including deep-link reloads.
How did you verify your code works?
I've ran all local tests. I compiled it to an executable
opencodeand run it behind reverse proxy with prefix.Checklist
If you do not follow this template your PR will be automatically rejected.