HOW TO PROXY 'ANY' WEBSITE USING CLOUDFLARE WORKERS


1. Sign up on https://www.cloudflare.com/ if not already.

2. Click on workers tab.

3. Choose a subdomain where you would like to see your workers.

   *such as zyx.subdomain.workers.dev

   *here zyx will be replaced by your future worker names.

   *the subdomain will stay same

4. After selecting subdomain click on create a service/worker.

5. Name your new worker anything you want.

6. Click create.

7. Click quick edit.

8. Click next.

9. Delete existing code.

X. Paste the following code there.

async function handleRequest(request) {

  const url = new URL(request.url)

  if (url.hostname in ORIGINS) {

    const target = ORIGINS[url.hostname]

    url.hostname = target

    return fetch(url.toString(), request)

  }

  return fetch(request)

}

addEventListener('fetch', event => {

  event.respondWith(handleRequest(event.request))

})


const ORIGINS = {

  '1337x.subdomain.workers.dev': '1337x.to'

}   



Replace 1337x with whatever you named your new worker.

Replace 1337x.to with the website you want to be proxied.

Don't enter https://1337x.to/

Only 1337x.to



BOOM you can access your proxied website at 1337x.subdomain.workers.dev

Enjoy and cheers!


** Not all websites can be proxied. Either because the websites don't want to be proxied or because can't be proxied through cloudflare workers or because cloudflare itself doesn't support them.


-- leaving some of my own workers. Feel free to use them.

https://1337x.unban.workers.dev

https://scrolller.unban.workers.dev


Enjoy! Follow us for more... 

No comments:

Post a Comment

How to use objects in JavaScript framework.mp4

  In JavaScript frameworks (like React, Angular, or Vue), objects are commonly used to manage and structure data, represent state, pass prop...