fix: client dev server proxy + centralize port defaults to 9460-9463#840
Open
fix: client dev server proxy + centralize port defaults to 9460-9463#840
Conversation
…ath stripping
Express mount paths (app.use('/api', proxy)) strip the prefix from req.url
in http-proxy-middleware v3, so /api/workspaces was forwarded as /workspaces.
Socket.IO, bootstrap/setup-state.js, and /health were also broken.
Switch to pathFilter option which preserves the full request path.
…t-sniffing - Add server/portDefaults.js as single source of truth for all port defaults - New default range: 9460-9463 (unregistered IANA, zero known conflicts) - 9460: orchestrator server - 9461: client dev server - 9462: diff viewer - 9463: tauri dev - Remove all client-side port-sniffing patterns (window.location.port === '2080') that were workarounds for the broken proxy — now just use window.location.origin - Update all server-side files to import from portDefaults instead of hardcoding - Update all config files (.env.example, tauri.conf.json, vite.config.js, etc.) - .env overrides still take precedence over defaults
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related fixes for the port/proxy architecture:
1. Fix client dev server proxy (was completely broken)
http-proxy-middlewarev3 changed its API —app.use('/api', proxy)strips the mount prefix, so/api/workspaceswas forwarded as/workspaces(404)index.htmlinstead of handshake/bootstrap/setup-state.jsand/healthwere never proxied at allpathFilteroption instead of Express mount paths2. Centralize port defaults to 9460-9463
server/portDefaults.js— single source of truth for all port defaults.envoverrides still take precedence over defaults3. Remove client-side port-sniffing workarounds
window.location.port === '2080' ? 'http://localhost:3000' : ...patterns (10+ occurrences across app.js, dashboard.js, conversation-browser.js)window.location.originFiles changed (24)
server/portDefaults.js(new) — centralized defaultsserver/index.js,server/commanderService.js,server/workspaceManager.js,server/diffViewerService.js— import from portDefaultsclient/dev-server.js— proxy fix + use portDefaultsclient/app.js,client/conversation-browser.js,client/dashboard.js— remove port-sniffing.env.example,diff-viewer/.env.example— new default portssrc-tauri/tauri.conf.json,src-tauri/src/main.rs— new default portsdiff-viewer/**— updated port referencesCLAUDE.md— updated documentationTest plan
npm start(uses.envoverrides if present, otherwise new defaults)http://localhost:<CLIENT_PORT>loads the full app with working terminals🤖 Generated with Claude Code