注意:这篇文章上次更新于1763天前,文章内容可能已经过时。
This article was last updated1763 days ago, the content may be outdated.
Prerequisites
Heroku account
A proxy (VPN) environment
Cloudflare account
Note: for all tutorial-style posts, keep their timeliness in mind. If you run into problems during deployment or the method stops working, feel free to leave a comment to discuss.
Free and fast!

开始部署
- 科学上网环境也许不是必要条件,主要是因为国内网络打开Heroku有点慢,所以有科学上网环境会使整个过程更加顺利一些。
- 注册账号的过程不予截图展示,先去注册好账号再来操作。
打开项目
首先,打开 Github项目 地址,点击部署到Heroku紫色按钮。
将项目 fork 到自己的账号下。
修改README.md 文件,将部署链接修改为自己的项目。

修改后提交即可。
接下来,点击部署按钮即可。

对于刚注册的Heroku账户,会弹出服务协议页面,点击接受就好了。正确的页面如下图所示,如果点击接受之后没有出现下面这个界面,可以重新打开GitHub项目点击部署按钮进行尝试。

此处的 APP name 在 Cloudflare 代理中还会用到,小白应该记住这个名字。当然了,这些信息其实都是可以查看的,熟练使用的话不需要刻意记。
生成UUID
-
打开 V2rayN 客户端,点击
服务器->添加VMess服务器
-
点击
生成按钮,记录用户ID并填入部署界面AUUID中。
部署
点击Deploy app按钮,如下显示即为部署成功。

点击Manage APP,进入管理页面,点击Setting,可以查看APP的详细信息,在域名栏中可以看到自己的项目地址,点击这个地址跳转到部署的伪装网站中,伪装网站默认为 Caddy works!



Start Deployment
- A proxy environment may not be strictly necessary; the main reason is that opening Heroku from mainland China networks is a bit slow, so having a proxy makes the whole process go more smoothly.
- I won’t show the account registration process in screenshots; go register your account first, then come back.
Open the Project
First, open the GitHub project page, click the purple Deploy to Heroku button.
Fork the project to your own account.
Modify the README.md file and change the deployment link to your own project.

Commit the changes after editing.
Next, click the deploy button.

For a newly registered Heroku account, a service agreement page will pop up; just click Accept. The correct page is shown below. If this interface doesn’t appear after clicking Accept, reopen the GitHub project and click the deploy button to try again.

The APP name here will also be used in the Cloudflare proxy later, so beginners should remember this name. Of course, all of this info can be looked up anytime, so if you’re experienced you don’t need to memorize it.
Generate a UUID
-
Open the V2rayN client, click
Server->Add VMess Server
-
Click the
Generatebutton, note down the user ID and fill it into the AUUID field on the deployment page.
Deployment
Click the Deploy app button; what’s shown below means the deployment succeeded.

Click Manage APP to enter the management page, then click Setting to view the APP’s details. In the domain column you can see your project’s address; clicking this address jumps to the deployed camouflage website, whose default is “Caddy works!”



Cloudflare 代理
-
登录后点击
Workers
-
点击
创建Worker
-
在弹出页面中的脚本填入下面的代码,并按图示步骤操作。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20const SingleDay = '应用程序名1.herokuapp.com'
const DoubleDay = '应用程序名2.herokuapp.com'
addEventListener(
"fetch",event => {
let nd = new Date();
if (nd.getDate()%2) {
host = SingleDay
} else {
host = DoubleDay
}
let url=new URL(event.request.url);
url.hostname=host;
let request=new Request(url,event.request);
event. respondWith(
fetch(request)
)
}
)
-
获取新的代理地址。

Cloudflare Proxy
-
After logging in, click
Workers
-
Click
Create Worker
-
Paste the following code into the script box on the pop-up page, and follow the steps shown in the screenshots.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20const SingleDay = '应用程序名1.herokuapp.com'
const DoubleDay = '应用程序名2.herokuapp.com'
addEventListener(
"fetch",event => {
let nd = new Date();
if (nd.getDate()%2) {
host = SingleDay
} else {
host = DoubleDay
}
let url=new URL(event.request.url);
url.hostname=host;
let request=new Request(url,event.request);
event. respondWith(
fetch(request)
)
}
)
-
Get the new proxy address.

上述代码实际上是对两个应用程序之间做了一个简单的负载均衡处理,单双号使用不同的应用程序上网。
截图中并没有这样处理。
建议使用这种负载均衡的方式运行程序,避免过度使用而造成封号。
具体方式为:
- 按上述步骤再部署一个应用程序,需要注意使用相同的UUID和path!!!
- 代码中的 应用程序名1 和 应用程序名2 分别替换成两个不同的名称,点击部署即可。
下面提供一种多个程序做负载均衡的代码。
1 | const Day0 = 'app0.herokuapp.com' |
The code above essentially does simple load balancing between two apps, using different apps on odd/even days.
The screenshots don’t do this.
It’s recommended to run the program with this kind of load balancing to avoid excessive usage leading to an account ban.
The specific approach:
- Deploy another app following the steps above, making sure to use the same UUID and path!!!
- Replace 应用程序名1 and 应用程序名2 in the code with two different names, then click deploy.
Below is code for load balancing across multiple apps.
1 | const Day0 = 'app0.herokuapp.com' |
客户端节点添加
以v2rayN客户端为例,添加VMess服务器, 信息填写如下图所示。 信息有所更改,注意下方的更正信息。

更正:
- 上图中的 9 (path)填写 / 即可。
- 上图中的 4 (alterId)填写 64.
速度挺快的,Youtube 1080p 轻松。缺点是不能上 Google 学术。流媒体我没测试,大概率应该也上不去。
建议作为备用节点,别把🐏薅死了,可能像 IBM Cloud 一样核平解决此事。
Adding a Client Node
Using the v2rayN client as an example, add a VMess server, fill in the info as shown below. The info has changed; note the corrections below.

Correction:
- For item 9 (path) in the image above, just fill in /.
- For item 4 (alterId) in the image above, fill in 64.
It’s quite fast — Youtube 1080p is effortless. The downside: Google Scholar doesn’t work. I haven’t tested streaming, and it probably won’t work either.
Recommended as a backup node. Don’t shear the 🐏 to death, or it might get peacefully nuked just like IBM Cloud.


