[PR #12333] feat: base path support (rebased from #7625) #14170

Closed
opened 2026-02-16 18:18:58 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12333

State: closed
Merged: No


Summary

  • Rebases base-path support from PR #7625 onto v1.2.13
  • Adds --base-path CLI option, OPENCODE_BASE_PATH env var, and server.basePath config
  • Rewrites HTML/JS/CSS responses at runtime to include the base path
  • Injects window.__OPENCODE_BASE_PATH__ into frontend for SolidJS Router compatibility

What this PR does

This is a rebase of @prokube's excellent work in #7625 onto the latest release tag (v1.2.13), resolving conflicts that arose from 275+ commits of drift.

Key features:

  • Configurable base path via CLI (--base-path), env var (OPENCODE_BASE_PATH), or config (server.basePath)
  • Runtime rewriting of proxied frontend assets to work under any URL prefix
  • History API wrapper to prepend base path to pushState/replaceState calls
  • Vite base path function patching for dynamic asset loading
  • Health endpoint now returns basePath for clients to discover the configuration

Testing

# Start server with base path
opencode web --base-path /myapp

# Or via environment variable
OPENCODE_BASE_PATH=/myapp opencode web

Access at http://localhost:4096/myapp/

Related

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12333 **State:** closed **Merged:** No --- ## Summary - Rebases base-path support from PR #7625 onto v1.2.13 - Adds `--base-path` CLI option, `OPENCODE_BASE_PATH` env var, and `server.basePath` config - Rewrites HTML/JS/CSS responses at runtime to include the base path - Injects `window.__OPENCODE_BASE_PATH__` into frontend for SolidJS Router compatibility ## What this PR does This is a rebase of @prokube's excellent work in #7625 onto the latest release tag (v1.2.13), resolving conflicts that arose from 275+ commits of drift. **Key features:** - Configurable base path via CLI (`--base-path`), env var (`OPENCODE_BASE_PATH`), or config (`server.basePath`) - Runtime rewriting of proxied frontend assets to work under any URL prefix - History API wrapper to prepend base path to pushState/replaceState calls - Vite base path function patching for dynamic asset loading - Health endpoint now returns `basePath` for clients to discover the configuration ## Testing ```bash # Start server with base path opencode web --base-path /myapp # Or via environment variable OPENCODE_BASE_PATH=/myapp opencode web ``` Access at `http://localhost:4096/myapp/` ## Related - Original PR: #7625 - Original issue: #7624 🤖 Generated with [Claude Code](https://claude.com/claude-code)
yindo added the pull-request label 2026-02-16 18:18:58 -05:00
yindo closed this issue 2026-02-16 18:18:58 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14170