Skip to content

feat: add URL-prefix support to OpenCode Web (even behind prefix-stripping reverse proxies) - #47977

Draft
fromelicks wants to merge 34 commits into
anomalyco:devfrom
fromelicks:prefix-support
Draft

feat: add URL-prefix support to OpenCode Web (even behind prefix-stripping reverse proxies)#47977
fromelicks wants to merge 34 commits into
anomalyco:devfrom
fromelicks:prefix-support

Conversation

@fromelicks

@fromelicks fromelicks commented Sep 8, 2026

Copy link
Copy Markdown

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

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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 opencode and run it behind reverse proxy with prefix.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

fabiovincenzi and others added 30 commits June 1, 2026 11:22
# Conflicts:
#	packages/opencode/src/server/routes/instance/httpapi/server.ts
#	packages/opencode/src/server/server.ts
# Conflicts:
#	packages/opencode/src/server/routes/instance/httpapi/server.ts
fabiovincenzi and others added 4 commits August 23, 2026 16:20
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.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Hey! Your PR title Prefix support doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@fromelicks fromelicks changed the title Prefix support feat: add URL-prefix support to OpenCode Web (even behind prefix-stripping reverse proxies) Sep 8, 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.

OpenCode server URLs drop full path in v2 [FEATURE]: Base path / prefix routing support

2 participants