Skip to main content

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 ~/.ccs/config.yaml on server:
Security: Generate strong random keys:
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 --import flag (Kiro only) to copy token from local machine
  • Temporarily run on desktop, copy ~/.ccs/cliproxy/*.json to server
4

Start Proxy as Systemd Service

Create service file /etc/systemd/system/ccs-proxy.service:
Enable and start:
5

Setup Reverse Proxy (Optional but Recommended)

Use nginx for HTTPS termination:
Obtain SSL certificate:
6

Configure Client

On your local machine, edit ~/.ccs/config.yaml:
Alternative: Use CLI flags:
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.
Note: These variables are for outbound network access. For CLIProxy server configuration, use the CCS-specific variables below.

CCS Environment Variables

CLI Flags

Config Priority

  1. CLI flags (highest priority)
  2. Environment variables
  3. config.yaml
  4. Defaults (lowest priority)

Security Best Practices

Authentication

  • Rotate keys regularly - Update api_key and management_secret quarterly
  • Use different keys - Separate auth_token and management_key
  • Limit scope - api_key for queries, management_key for 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/summary endpoint

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)
Solution: Verify tokens match:

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: false in config
  • fallback.auto_start: false and local binary missing
Solution:

Advanced Configuration

Multi-Region Deployment

Planned Feature - Multi-region auto-selection is not yet implemented. This configuration syntax is reserved for future use.
Deploy proxies in different regions, clients auto-select fastest:

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