fix(vite): proxy /plugin-ws WebSocket requests to the backend in dev#757
fix(vite): proxy /plugin-ws WebSocket requests to the backend in dev#757ehsanmim wants to merge 1 commit into
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe pull request adds a new Vite development server websocket proxy route at ChangesPlugin Websocket Proxy Configuration
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
Summary
Plugin WebSocket connections hang in
npm run devbecause Vite's dev server proxies/api,/ws, and/shellto 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
cloudcli-ai/cloudcli-plugin-terminal.npm run dev.http://localhost:5173and click the Terminal tab./plugin-ws/web-terminalconnection attempt because the request never leaves Vite.Fix
Add
/plugin-wsto the Vite proxy block invite.config.js, matching the existing/wsand/shellentries: