chm-dev / cloudflare-cors-anywhere

CORS "anywhere" proxy with pages viewing capability in a Cloudflare worker.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This script is modified !

It's been modified so you can view html pages through it. It changes urls of assets, links (relative and absolute). All assets, scripts etc are either replaced with absolute url to dest host or left untouched. Links are amended so navigation should remain in the proxy.

cloudflare-cors-anywhere

Cloudflare CORS proxy in a worker.

CLOUDFLARE-CORS-ANYWHERE

Source: https://github.com/Zibri/cloudflare-cors-anywhere

Demo: https://test.cors.workers.dev

Donate: https://paypal.me/Zibri/5

Post: http://www.zibri.org/2019/07/your-own-cors-anywhere-proxy-on.html

Deploy workers: https://workers.cloudflare.com/

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.

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.

About

CORS "anywhere" proxy with pages viewing capability in a Cloudflare worker.

License:MIT License


Languages

Language:JavaScript 100.0%