Skip to content

ZHider/cloudflare-cors-anywhere-2026

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cloudflare-cors-anywhere

Cloudflare CORS proxy in a worker.

CLOUDFLARE-CORS-ANYWHERE

Source: https://github.com/ZHider/cloudflare-cors-anywhere-2026

Deployment

This project is written in Cloudfalre Workers, and can be easily deployed with Wrangler CLI.

# Command could be various due to your package manager
# Here is pnpm for example
# install wrangler to deploy
pnpm install -D wrangler
pnpm exec wrangler deploy

Usage Example

fetch("https://test.cors.workers.dev/?https://httpbin.org/post", {
    method: "post",
    headers: {
        "x-foo": "bar",
        "x-bar": "foo",
        "x-cors-headers": JSON.stringify({
            // allows to send forbidden headers
            // https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name
            cookies: "x=123",
        }),
    },
})
    .then((res) => {
        // allows to read all headers (even forbidden headers like set-cookies)
        const headers = JSON.parse(res.headers.get("cors-received-headers"));
        console.log(headers);
        return res.json();
    })
    .then(console.log);

Note

All received headers are also returned in "cors-received-headers" header.

To create your own is very easy, you just need to set up a cloudflare account and deploy the worker code.

THANKS to Zibri, the source of idea and the original code! Though I basically rewrite all over it for my own convenience since I found it could not be deployed directly to Cloudflare worker in 2026.

About

CORS "anywhere" proxy in a Cloudflare worker.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%