corsx is a lightweight CORS proxy running on Cloudflare's edge network. Helps client-side JavaScript fetch content from any URL without CORS restrictions.
https://corsx.kezanwar.workers.dev
const proxyUrl = "https://corsx.kezanwar.workers.dev/proxy";
const targetUrl = "https://api.example.com/data";
const response = await fetch(
`${proxyUrl}?url=${encodeURIComponent(targetUrl)}`,
);
const data = await response.json();- Install Wrangler CLI:
npm install -g wrangler- Login to Cloudflare:
wrangler login- Clone and deploy:
git clone https://github.com/kezanwar/corsx
cd corsx- Create the rate limit KV namespace:
npx wrangler kv namespace create RATE_LIMIT- Copy the ID from the output and update
wrangler.toml:
[[kv_namespaces]]
binding = "RATE_LIMIT"
id = "your-id-here"- Deploy:
wrangler deployThat's it. You'll get a URL like https://corsx.YOUR_SUBDOMAIN.workers.dev.
| Endpoint | Description |
|---|---|
GET / |
Landing page with docs and interactive demo |
GET /proxy?url=<url> |
Proxy a request |
POST /proxy?url=<url> |
Proxy a POST request (body forwarded) |
GET /health |
Health check |
- Fast — Runs on Cloudflare's global edge network
- Free — 100k requests/day on free tier
- SSRF Protection — Blocks internal/private IPs
- Full CORS — All the right headers, preflight handled
- POST Support — Forwards request body
Added to all proxied responses:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
X-Proxied-By: corsx
X-Original-URL: <original-url>
wrangler devOpens a local server at http://localhost:8787.
Edit wrangler.toml:
routes = [
{ pattern = "cors.yourdomain.com", custom_domain = true }
]Then redeploy with wrangler deploy.
MIT