Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Zibri/cloudflare-cors-anywhere
CORS "anywhere" proxy in a Cloudflare worker. DEMO at: https://test.cors.workers.dev/
https://github.com/Zibri/cloudflare-cors-anywhere
cloudflare cors fastest free proxy
Last synced: about 2 months ago
JSON representation
CORS "anywhere" proxy in a Cloudflare worker. DEMO at: https://test.cors.workers.dev/
- Host: GitHub
- URL: https://github.com/Zibri/cloudflare-cors-anywhere
- Owner: Zibri
- License: mit
- Created: 2019-07-15T08:33:36.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-24T20:24:09.000Z (7 months ago)
- Last Synced: 2024-10-25T04:51:22.054Z (about 2 months ago)
- Topics: cloudflare, cors, fastest, free, proxy
- Language: JavaScript
- Homepage:
- Size: 51.8 KB
- Stars: 663
- Watchers: 10
- Forks: 250
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE_MIT
Awesome Lists containing this project
README
# cloudflare-cors-anywhere
Cloudflare CORS proxy in a worker.CLOUDFLARE-CORS-ANYWHERE
Source:
https://github.com/Zibri/cloudflare-cors-anywhereDemo:
https://test.cors.workers.devDonate:
https://paypal.me/Zibri/5Post:
http://www.zibri.org/2019/07/your-own-cors-anywhere-proxy-on.html## Deployment
This project is written in [Cloudfalre Workers](https://workers.cloudflare.com/), and can be easily deployed with [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/install-and-update/).
```bash
wrangler publish
```## Usage Example
```javascript
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.
Note about the DEMO url:
Abuse (other than testing) of the demo will result in a ban.
The demo accepts only fetch and xmlhttprequest.To create your own is very easy, you just need to set up a cloudflare account and upload the worker code.
My personal thanks to Damien Collis for his generous and unique donation.