Overview
Remote proxy deployment allows you to:- Centralize OAuth tokens - Team shares one authenticated server
- Bypass network restrictions - Route through server with API access
- Reduce client setup - No local binary installation needed
- Monitor usage centrally - Track all requests through proxy
Architecture
Prerequisites
- Linux server with public IP or domain
- Root/sudo access for port binding (80/443)
- CCS CLI installed locally
- Basic understanding of systemd (for persistent service)
1
Install CLIProxyAPI on Server
SSH into your server and install CCS:Verify installation:Note: Server doesn’t need Claude Code installed, only CCS CLI.
2
Configure Server-Side Proxy
Create Security: Generate strong random keys:
~/.ccs/config.yaml on server:3
Authenticate OAuth Providers
On the server, authenticate each provider:Important: Server needs a browser for OAuth flow. Options:
- SSH with X11 forwarding:
ssh -X user@server - Use
--importflag (Kiro only) to copy token from local machine - Temporarily run on desktop, copy
~/.ccs/cliproxy/*.jsonto server
4
Start Proxy as Systemd Service
Create service file Enable and start:
/etc/systemd/system/ccs-proxy.service:5
Setup Reverse Proxy (Optional but Recommended)
Use nginx for HTTPS termination:Obtain SSL certificate:
6
Configure Client
On your local machine, edit Alternative: Use CLI flags:
~/.ccs/config.yaml:7
Test Connection
Verify client can reach remote proxy:Check logs on server:Expected output:
8
Configure Fallback Behavior
Control what happens if remote fails:Fail Fast (No Fallback):Exits with error if remote unreachable.Force Local (Skip Remote):Uses local proxy even if remote configured.Graceful Degradation (Default):
Configuration Reference
Corporate Proxy Support
CCS respects standard system proxy environment variables for binary downloads and network requests:
Use case: When downloading CLIProxy binary or making outbound requests from behind a corporate firewall.
CCS Environment Variables
CLI Flags
Config Priority
- CLI flags (highest priority)
- Environment variables
- config.yaml
- Defaults (lowest priority)
Security Best Practices
Authentication
- Rotate keys regularly - Update
api_keyandmanagement_secretquarterly - Use different keys - Separate
auth_tokenandmanagement_key - Limit scope -
api_keyfor queries,management_keyfor admin operations
Network Security
- Use HTTPS - Always in production (self-signed OK for internal networks)
- Firewall rules - Restrict proxy port to known IPs:
- VPN recommended - Route traffic through VPN for extra security
Monitoring
- Log all requests - Enable in config:
- Monitor disk usage - Logs can grow large, rotate with logrotate
- Track quotas - Use
/api/usage/summaryendpoint
Troubleshooting
Connection Refused
Symptom:[X] Proxy error: ECONNREFUSED
Causes:
- Server not running:
sudo systemctl status ccs-proxy - Firewall blocking:
sudo ufw status - Wrong port in config
Authentication Failed
Symptom:[X] Auth error: Invalid token
Causes:
- Token mismatch between client and server
- Token expired (server restarted with new config)
SSL Certificate Errors
Symptom:[X] Network error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
Solutions:
Fallback Not Working
Symptom: Remote fails but local doesn’t start Causes:fallback.enabled: falsein configfallback.auto_start: falseand local binary missing
Advanced Configuration
Multi-Region Deployment
Planned Feature - Multi-region auto-selection is not yet implemented. This configuration syntax is reserved for future use.
Load Balancing
Use nginx upstream for multiple proxy instances:Next Steps
Multi-Account Setup
Manage multiple OAuth accounts on the proxy server
Token Management
Understand token refresh and session persistence
