Lightweight Go proxy for the Clash of Clans API with rotating production keys, built-in request stats, and a Cloudflare Worker asset proxy for CORS-safe image delivery.
- Rotates requests across multiple production API keys from
COC_KEYS - Proxies Clash of Clans production traffic under
/v1/ - Exposes rolling request, latency, status-code, and endpoint usage metrics at
/stats - Includes
assets-proxy.jsfor proxying Clash of Clans API assets through Cloudflare Workers - Keeps metrics aggregate-only; do not log bearer tokens,
COC_KEYS, raw authorization headers, request bodies, or client IP addresses
- Go 1.26.2+ recommended
- One or more Clash of Clans API keys
| Variable | Required | Default | Description |
|---|---|---|---|
COC_KEYS |
Yes | - | Comma-separated Clash of Clans API keys used for /v1/ requests |
HOST |
No | 0.0.0.0 |
Bind host |
PORT |
No | 8011 |
Bind port |
DEV_COC_URL |
No | - | Base URL for the /dev/ upstream |
The server also loads a local .env file automatically when present.
export COC_KEYS="key1,key2"
go run .docker build -t clashking-proxy .
docker run --rm -p 8011:8011 -e COC_KEYS="key1,key2" clashking-proxyGET /health-style status responseGET /statsrolling stats summaryGET /stats?series=5m&lookback=48htime-series metricsGET /stats?endpoints=24h&limit=25top endpoint usage/v1/*proxied tohttps://api.clashofclans.com/v1/with rotated bearer keys/dev/*proxied toDEV_COC_URLand forwards the incomingAuthorization: Bearer ...header
Example:
curl http://localhost:8011/v1/players/%23PLAYER_TAGassets-proxy.js is a standalone Cloudflare Worker proxy for Clash of Clans API image assets.
Example:
Proxy:
https://assets-proxy.clashk.ing/badges/512/
eX-l0ROdCFJw-nYPv721y1exbwOwDBZZRZuxMRGg2xo.png
Upstream:
https://api-assets.clashofclans.com/badges/512/
eX-l0ROdCFJw-nYPv721y1exbwOwDBZZRZuxMRGg2xo.png