Skip to content

fix(vite): proxy /plugin-ws WebSocket requests to the backend in dev#757

Open
ehsanmim wants to merge 1 commit into
siteboon:mainfrom
ehsanmim:fix/vite-plugin-ws-proxy
Open

fix(vite): proxy /plugin-ws WebSocket requests to the backend in dev#757
ehsanmim wants to merge 1 commit into
siteboon:mainfrom
ehsanmim:fix/vite-plugin-ws-proxy

Conversation

@ehsanmim
Copy link
Copy Markdown

@ehsanmim ehsanmim commented May 9, 2026

Summary

Plugin WebSocket connections hang in npm run dev because Vite's dev server proxies /api, /ws, and /shell to the backend but not /plugin-ws/*. The browser opens the WS against Vite (port 5173), Vite has no rule for that path, and the connection sits forever in the "Connecting…" state.

Production builds are unaffected: the same Express server serves both the frontend and the WS gateway, so no proxy is involved.

This was missed when the plugin WebSocket proxy was introduced in #553 — the backend route was added but the corresponding dev-proxy entry wasn't.

Reproduction

  1. Install a plugin that uses a WebSocket backend, e.g. the official Terminal plugin: cloudcli-ai/cloudcli-plugin-terminal.
  2. npm run dev.
  3. Open http://localhost:5173 and click the Terminal tab.
  4. The terminal stays on "Connecting… Starting shell session" indefinitely. The backend log shows no /plugin-ws/web-terminal connection attempt because the request never leaves Vite.

Fix

Add /plugin-ws to the Vite proxy block in vite.config.js, matching the existing /ws and /shell entries:

'/plugin-ws': {
  target: `ws://${proxyHost}:${serverPort}`,
  ws: true
}


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Chores**
  * Updated development server configuration to support additional server connectivity routes, enhancing underlying communication infrastructure for extended functionality.

[![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/siteboon/claudecodeui/pull/757)

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Plugin WebSocket connections (e.g. the official Terminal plugin) hang
in `npm run dev` because Vite proxies /api, /ws, and /shell but not
/plugin-ws/*. Production is unaffected because the same Express server
serves both the frontend and the WS gateway.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4d2140c6-b564-43cd-b9f6-6a93952501e9

📥 Commits

Reviewing files that changed from the base of the PR and between 039696c and f4b97bc.

📒 Files selected for processing (1)
  • vite.config.js

📝 Walkthrough

Walkthrough

The pull request adds a new Vite development server websocket proxy route at /plugin-ws that forwards traffic to the same backend websocket server as the existing /shell proxy. The configuration change enables websocket protocol support for the new route.

Changes

Plugin Websocket Proxy Configuration

Layer / File(s) Summary
Websocket Proxy Configuration
vite.config.js
New /plugin-ws websocket proxy route is added to forward requests to ws://${proxyHost}:${serverPort} with websocket support enabled, alongside the existing /shell proxy.

Suggested reviewers

  • blackmammoth

Poem

🐰 A websocket tunnel, shiny and new,
/plugin-ws awaits your breakthrough,
To the server it routes, without a care,
Vite's config now ready to share!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a WebSocket proxy route for /plugin-ws in Vite's dev configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant