Skip to content

refactor(core): add full http proxy and change workspace adaptor interface#21239

Merged
jlongster merged 3 commits intodevfrom
jlongster/http-proxy
Apr 7, 2026
Merged

refactor(core): add full http proxy and change workspace adaptor interface#21239
jlongster merged 3 commits intodevfrom
jlongster/http-proxy

Conversation

@jlongster
Copy link
Copy Markdown
Contributor

The previous approach was bad:

  • It forces workspace adaptors to proxy a fetch request manually and it was too much work
  • The fetch API wasn't a full http proxy; it didn't support websockets which will break stuff like our terminal support in the webapp

This changes it so a remote env just need to supply a remote HTTP URL and we will handle the full proxying for them

@jlongster jlongster force-pushed the jlongster/http-proxy branch from 7fd792e to 2572c28 Compare April 6, 2026 22:13
@mingfang
Copy link
Copy Markdown

mingfang commented Apr 6, 2026

this is super useful. would be great if we can configure proxies in opencode.json. (similar to vite.config)

@jlongster
Copy link
Copy Markdown
Contributor Author

@mingfang go on? currently this is specifically for workspaces (when you create a session in a remote env that you'll be able to configure, not released yet) are you thinking something more general with the opencode server?

@mingfang
Copy link
Copy Markdown

mingfang commented Apr 6, 2026

@mingfang go on? currently this is specifically for workspaces (when you create a session in a remote env that you'll be able to configure, not released yet) are you thinking something more general with the opencode server?

Yes, make proxy a first class feature. I'm using the SDK from a webapp. My app requires hitting other APIs and many times encounter CORS issues. Currently I have Nginx in front to do the proxying. With your new feature, I was hoping to remove Nginx to reduce complexity.

@jlongster jlongster merged commit 37883a9 into dev Apr 7, 2026
10 checks passed
@jlongster jlongster deleted the jlongster/http-proxy branch April 7, 2026 03:19
@jlongster
Copy link
Copy Markdown
Contributor Author

@mingfang unfortunately I'm not sure we're going to add a full proxy support to the opencode server to hit arbitrary endpoints. It's a bit outside the scope of opencode and we'd get all kind of support requests dealing with that (which is complex and tends to have a lot of edge cases)

this feature specifically is for our workspaces support, which is about to support a remote environment. we are specifically only proxying opencode requests from a "main" opencode instance to a "remote" one. because we are only proxing between opencode itself, we know what we need to support and it is a lot smaller support than an arbitrary proxy

@mingfang
Copy link
Copy Markdown

mingfang commented Apr 7, 2026

@jlongster no worries. I agree with you; it's out of scope.
Connecting opencode server like this sounds very interesting.
Where can I learn more about this, besides the code, I mean the future plans for this feature?
Thanks!

hugojosefson pushed a commit to hugojosefson/opencode that referenced this pull request Apr 7, 2026
cavaldos pushed a commit to cavaldos/openpentest that referenced this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants