cors-anywhere, read from the source
Disclosure: corsproxy.dev is our product. Everything below about cors-anywhere comes from its own MIT-licensed GitHub repository — specifically lib/cors-anywhere.js, its README, and its npm package listing, as read on the date below. Rob Wu's cors-anywhere is the Node.js library behind the famous cors-anywhere.herokuapp.com demo and behind a large share of the self-hosted CORS proxies developers have deployed since 2013. We read the module that actually runs, not the demo's usage page, to see what it checks before forwarding a request and what it leaves to whoever deploys it.
What it is
The package exports one function, createServer(options), that wraps http-proxy in about 450 lines (lib/cors-anywhere.js). You deploy it yourself with require('cors-anywhere').createServer(options).listen(...); there's no managed version, no API key, and no dashboard. A request to /https://api.example.com/path gets the target URL parsed out of the path, the browser's preflight answered inline, and the real request forwarded through http-proxy. The npm package is still at version 0.4.4, last published in March 2021 according to its npm listing, and the code on master matches that version exactly, so what follows describes the same thing a fresh npm install cors-anywhere gets you today.
Credentials are blocked on the way back, not on the way in
The README states plainly that the library "does not put any restrictions on the http methods or headers, except for cookies," and that user credentials are disallowed. Reading withCORS() and onProxyResponse() shows what that means in practice: every response always gets Access-Control-Allow-Origin: *, Access-Control-Allow-Credentials is never set, and Set-Cookie / Set-Cookie2 are deleted from the upstream response before it reaches the browser. That's enough to stop a page from reading a credentialed response or picking up a session cookie through the proxy, because the Fetch spec already forbids pairing a wildcard origin with credentials: 'include', covered in CORS with cookies and credentials.
What it doesn't do is strip the request going the other way. removeHeaders defaults to an empty array, and nothing in getHandler() touches Authorization or Cookie on its own. The README's own example config removes them explicitly — removeHeaders: ['cookie', 'cookie2'] — which only works because the person deploying the library copied that line. Skip it, and a browser that still sends a Cookie or Authorization header on the request (outside the credentialed-fetch case the response-side block already closes off) has that header forwarded to whatever the path points at, unchanged.
There's no check on the target address
The only gate before a URL gets proxied is isValidHostName():
function isValidHostName(hostname) {
return !!(
regexp_tld.test(hostname) ||
net.isIPv4(hostname) ||
net.isIPv6(hostname)
);
}
That function answers "is this shaped like a hostname or an IP address," not "is this address safe to fetch." 127.0.0.1, 10.0.0.5, and 169.254.169.254 all pass net.isIPv4() the same as any public address, so they all pass this check and get proxied. There's no private-range, loopback, or link-local filter anywhere in the module, and the originWhitelist / originBlacklist options control who can call the proxy, not where the proxy is allowed to point. A deployment with an open origin policy — the default, since originWhitelist starts empty — will relay a request to a private address on its own network exactly as readily as to a public API. We cover the general shape of this risk in SSRF IP obfuscation: what gets past a CORS proxy; here there isn't an obfuscation trick to get past, because there's nothing to get past in the first place.
Redirects are followed in-process, with one exception
A 301, 302, or 303 from the target doesn't reach the browser. onProxyResponse() catches it, re-parses the Location header, and calls proxyRequest() again against the new URL, downgrading the method to GET and dropping the body each time, up to maxRedirects (default 5). 307 and 308 are deliberately excluded from that loop — the code comments that preserving the method and body for those is more than it wants to do — so those pass through to the browser untouched, same as a normal fetch would see them. Each followed redirect reuses the same isValidHostName() check, which is to say the same non-check: nothing stops a redirect chain from landing on a private address any more than the first request does.
Everything that survives gets exposed
Before a response goes back, withCORS() sets Access-Control-Expose-Headers to Object.keys(headers).join(',') — every header name still on the response after Set-Cookie was stripped, listed out so fetch's Headers object can actually read them. That's the opposite default from a proxy that forgets to set the header at all, the failure mode we cover in Access-Control-Expose-Headers, explained, and it's a reasonable choice for a tool whose whole job is letting a frontend see responses it otherwise couldn't.
What this means if you're running a copy
None of this makes cors-anywhere badly built for what it was written for in 2013: a proxy you run yourself, pointed at APIs you trust, called from a frontend you control. The credential handling is actually more conservative than some of the forks and reimplementations it inspired. It stops being low-risk the moment two things are both true: the deployment's origin policy is left open (the default), and its target isn't restricted to a known allowlist — at that point it's a relay that will forward a browser's own Authorization or Cookie header to any address on the path, private ones included. If you're running your own copy, the options already in the library close most of that gap: set originWhitelist to the origins you actually expect, add removeHeaders: ['cookie', 'cookie2'] even if you don't think you need it, and put a hostname or IP check in front of createServer via handleInitialRequest, since the library has no address check of its own to lean on.
If you're on this page because the Heroku demo stopped letting you through, that's a separate, deliberate restriction on cors-anywhere.herokuapp.com itself, not a bug in the library — we cover the fix in cors-anywhere alternative: migrate to corsproxy.dev. corsproxy.dev strips Authorization and Cookie from the browser's request by default and blocks private and loopback targets before fetching, so a free key gets you the locked-down version of this without patching options in yourself.