1 Star 0 Fork 0

xAsiimov / Workers-Proxy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Workers-Proxy

LICENSE Pull requests GitHub stars

Introduction

Workers-Proxy 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.

Demo

Reverse-Proxy Project (This demo may not available in specific regions.)

Getting Started

Build and Deploy

Deploy with Wrangler

  1. Installing Wrangler.

  2. Generate a new project.

wrangler generate my-workers-proxy https://github.com/Siujoeng-Lau/Workers-Proxy
  1. Configure your project's wrangler.toml file to prepare your project for deployment.
wrangler config
  1. Build and deploy on Cloudflare Workers.
wrangler build
wrangler publish

Deploy manually

  1. Navigate to Cloudflare Workers, register or sign in your Cloudflare account, and set custom subdomain for workers, and create a new Worker.

  2. Customize 'index.js', paste the code into Cloudflare online editor to replace the default one.

  3. Change name of your Worker, save and deploy it, and check whether its performance fulfills your demand.

Bind to Custom Domain

  1. Check whether your domain is currently under Cloudflare's protection.

  2. Navigate to the dashboard of your domain, select 'Workers' page, and click on 'Add Route'.

  3. Type https://<domain-name>/* in Route and select the Worker you created previously.

  4. 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'.

Customize index.js

Basically, there are a few constants on the top of the 'index.js' file.

To customize your own Workers-Proxy Service, you should edit these constants according to your expectations.

// Website you intended to retrieve for users.
const upstream = 'www.google.com'

// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = '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']

// Replace texts.
const replace_dict = {
    '$upstream': '$custom_domain',
    '//google.com': ''
}
MIT License Copyright (c) 2019 Siujoeng-Lau Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Lightweight reverse proxy implemented with Cloudflare Workers. 展开 收起
Visual Basic
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Visual Basic
1
https://gitee.com/xAsiimov/Workers-Proxy.git
git@gitee.com:xAsiimov/Workers-Proxy.git
xAsiimov
Workers-Proxy
Workers-Proxy
master

搜索帮助