Skip to content
/ worker Public

๐ŸŒ A simple and fast Cloudflare Worker that acts as a proxy โ€” bypass access restrictions and reach any website via your own custom Worker endpoint

Notifications You must be signed in to change notification settings

mehdif5/worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 

Repository files navigation

worker

๐ŸŒ A simple and fast Cloudflare Worker that acts as a proxy โ€” bypass access restrictions and reach any website via your own custom Worker endpoint

How It Works

This Worker takes any incoming request, changes the hostname to your desired target (like example.com), and forwards the request. It then returns the response from the target website. You can use it to send request to unaccessible websites, specially it is suitable for telegram bot (api.telegram.org)

๐Ÿš€ Getting Started

1. Create a New Worker on Cloudflare

2. Replace the Default Code

Copy and paste the following code into the Worker editor:

async function handleRequest(request) {
  const url = new URL(request.url);

  // Change the hostname to your target domain
  url.hostname = 'myservice.com'; // โ† Replace this with your desired domain

  const newRequest = new Request(url.toString(), request);

  try {
    const response = await fetch(newRequest);
    return response;
  } catch (error) {
    return new Response('Internal Server Error', {
      status: 500,
      headers: {
        'content-type': 'text/plain',
      },
    });
  }
}

addEventListener('fetch', (event) => {
  event.respondWith(handleRequest(event.request));
});

3. Customize the Target Domain

Replace 'myservice.com' in the code with the domain you want to proxy traffic to.

url.hostname = 'wikipedia.org';

4. Deploy the Worker

Click โ€œSave and Deployโ€ and Copy your Worker URL Use it instead of the your service url.


โš ๏ธ Notes

  • This is a basic proxy. It doesnโ€™t rewrite content or handle advanced request/response logic.
  • No HTTPS validation or CORS headers are handled โ€” you can extend the code if needed.
  • Use responsibly and respect the terms of service of any proxied websites.

About

๐ŸŒ A simple and fast Cloudflare Worker that acts as a proxy โ€” bypass access restrictions and reach any website via your own custom Worker endpoint

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published