-
-
Notifications
You must be signed in to change notification settings - Fork 38
feat(cliproxy): add remote CLIProxy routing support #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
- add ProxyTarget interface with host, port, protocol, authToken, isRemote - implement getProxyTarget() to resolve target from unified config - add buildProxyUrl() and buildProxyHeaders() utilities - handle optional auth token (empty = no Authorization header)
- Refactor stats-fetcher.ts: 5 functions now use getProxyTarget() - Add remote-auth-fetcher.ts: fetch auth status from remote /v0/management/auth-files - Update cliproxy-auth-routes.ts: branch on isRemote for GET routes - Return 501 for account management in remote mode (unsupported)
- Use React Query to fetch cliproxy_server config - Build URLs dynamically based on remote/local mode - Add Globe icon and Remote badge indicator - Show context-aware error messages for remote failures
- Add runtime API response validation in remote-auth-fetcher - Add AbortController cleanup to prevent state updates after unmount - Validate postMessage origin matches iframe src before sending creds - Mask auth token display (show ***last4) for security - Reset error/connected state on refresh - Fix port default to use protocol-based (443 for https, 80 for http) - Normalize path in buildProxyUrl to ensure leading slash - Add fallback for undefined email (default to 'Unknown') - Extract timeout constant (REMOTE_FETCH_TIMEOUT_MS) - Remove unused RemoteAuthFilesResponse interface
- Add rewriteLocalhostUrls() to detect and rewrite localhost URLs - Support 127.0.0.1, localhost, 0.0.0.0 patterns - Update getEffectiveEnvVars() to accept remoteRewriteConfig param - Auto-rewrite saved settings URLs to remote server at runtime
- Import loadOrCreateUnifiedConfig to access cliproxy_server settings - Pass remote/local config to resolveProxyConfig() function - Enables CLI to detect remote mode from user's config.yaml
- Add remote mode detection via cliproxy-server-config query - Display blue-themed "Remote Proxy" widget when remote enabled - Show remote host and "Traffic auto-routed" message - Hide local start/stop/restart controls in remote mode
getRemoteEnvVars was ignoring user settings and always loading
models from base config. Now follows same priority as local mode:
1. Custom settings path (variant configs)
2. User settings file (~/.ccs/{provider}.settings.json)
3. Base config defaults
This fixes the issue where selecting Opus 4.5 in UI resulted in
Gemini 3 preview being loaded when using remote proxy mode.
Shows "Remote" badge with Globe icon and "Traffic auto-routed to remote server" message when remote CLIProxy mode is active.
- Change /cliproxy/accounts/* to /cliproxy/auth/accounts/* - Fix 404 errors when managing CLIProxy accounts from dashboard - Root cause: frontend called wrong endpoints for account management
- Add /usage alias for /cliproxy/stats (frontend compatibility) - Create account-routes.ts to fix /accounts/accounts double path - Update index.ts to mount accountRoutes at /accounts - Remove account code from profile-routes.ts - Clean up unused imports in profile-routes.ts
- Add try-catch to cliproxy-auth-routes GET / - Add try-catch to health-routes GET / and POST /fix/:checkId - Add try-catch to config-routes GET /format and POST /migrate - Improve error messages with specific context - All handlers now return 500 with error message on failure
- Add try-catch to all route handlers in settings, variant, config routes - Implement 5 missing endpoints in cliproxy-stats-routes: - GET/PUT /config.yaml for YAML config management - GET /auth-files to list auth directory files - GET /auth-files/download for file download - PUT /models/:provider to update model settings - All handlers now return proper error messages on failure
fix(api): resolve CLIProxy account management errors
Resolve conflicts in cliproxy-auth-routes.ts by combining: - Dev's improved error handling with try-catch patterns - Branch's remote mode routing logic All 638 tests pass.
feat(cliproxy): add remote CLIProxy routing with dev merge
- README: add remote CLIProxy section with CLI flags and quick setup - code-standards: add Config Priority Pattern (CLI > ENV > config.yaml) - codebase-summary: add new remote proxy files, update test counts (638) - project-overview-pdr: add FR-008 requirement, v7.1 release section - project-roadmap: add Phase 10 (Remote CLIProxy), mark #142 complete - system-architecture: add Remote CLIProxy Flow diagram
Contributor
|
🎉 This issue has been resolved in version 7.2.0 🎉 The release is available on: |
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
Adds comprehensive remote CLIProxy routing support enabling CCS to connect to remote CLIProxyAPI servers. This is a major feature for v7.1.
Changes
New Files
src/cliproxy/proxy-target-resolver.ts- Central proxy target resolution (local/remote)src/cliproxy/remote-auth-fetcher.ts- Fetch auth status from remote CLIProxyAPIsrc/web-server/routes/account-routes.ts- Account management endpointsRemote Routing (Core Feature)
src/cliproxy/cliproxy-executor.ts- Load remote config from config.yamlsrc/cliproxy/config-generator.ts- Add localhost URL rewriting for remote modesrc/cliproxy/stats-fetcher.ts- Refactored to use proxy target resolversrc/web-server/routes/cliproxy-auth-routes.ts- Branch on remote mode, return 501 for unsupported opsUI Updates
ui/src/components/cliproxy/control-panel-embed.tsx- Dynamic URLs, remote indicator, masked tokenui/src/components/cliproxy/provider-editor/*- Remote mode indicator in headerui/src/components/monitoring/proxy-status-widget.tsx- Show remote server infoAPI Improvements
Documentation
Key Features
Test Plan