WorkersProxy is a lightweight Javascript application that retrieves resource as a client from other servers.
Deploying on Cloudflare Workers, which is an influential platform for building serverless applications, you could build customized reverse proxy without purchasing computing engines and configuring web servers such as Nginx.
Moreover, crucial performance, such as latency and availability, will be optimized, since your application will be distributed through Cloudflare's global network of data centers in more than 90 countries.
By configuring Geolocation and IP address filters, you might directly suspend your reverse proxy service in specific countries or regions according to their regulations. Taking advantage of the mobile redirector, you could distribute various webpages based on users' devices.
Reverse-Proxy Project (This demo may not available in specific regions.)
-
Navigate to Cloudflare Workers, register or sign in your Cloudflare account, and set custom subdomain for workers, and create a new Worker.
-
Customize 'index.js', paste the code into Cloudflare online editor to replace the default one.
-
Change name of your Worker, save and deploy it, and check whether its performance fulfills your demand.
-
Check whether your domain is currently under Cloudflare's protection.
-
Navigate to the dashboard of your domain, select 'Workers' page, and click on 'Add Route'.
-
Type
https://<domain-name>/*
inRoute
and select the Worker you created previously. -
Add a CNAME DNS record for your custom domain. Concretely, enter the subdomain (or '@' for root) in the 'Name' field, enter the second level domain of your workers in the 'Target' field, and set 'Proxy status' to 'Proxied'.
Obviously, there's a few constants defined at the top of the main Javascript file.
To customize your own WorkersProxy Service, you should edit them according to your expectations.
// List of domains bind to your WorkersProxy.
const domain_list = ['https://cdn.reverse-proxy.live/', 'https://google.xasiimov.workers.dev/']
// Website you intended to retrieve for users.
const upstream = 'https://www.google.com/'
// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = 'https://www.google.com/'
// Countries and regions where you wish to suspend your service.
const blocked_region = ['CN', 'KP', 'SY', 'PK', 'CU']
// IP addresses which you wish to block from using your service.
const blocked_ip_address = ['0.0.0.0', '127.0.0.1']