出处:https://www.xrgzs.top/posts/lucky-stun-upnp-nat1
安装docker命令,有就不用执行
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
安装lucky命令
docker run -d --name lucky --restart=always --net=host -v /home/docker/luckyconf:/goodluck gdy666/lucky
端口测试网页:https://tool.chinaz.com/port
没有账号的注册个账号:https://dash.cloudflare.com/
![图片[1]-内网使用Lucky STUN+CF301重定向 实现纯域名不加端口号301P2P访问-小陈折腾日记](https://www.geekxw.top/wp-content/uploads/2024/08/Clip_20240801_190320-1024x544.png)
concat("http://66.66.66.66:6666", http.request.uri.path)
如果你内网是https访问的 这里的http也要改成https
API获取:https://dash.cloudflare.com/profile/api-tokens
接口地址获取:
提前F12打开控制台 点击保存
![图片[2]-内网使用Lucky STUN+CF301重定向 实现纯域名不加端口号301P2P访问-小陈折腾日记](https://www.geekxw.top/wp-content/uploads/2024/08/Clip_20240801_191055-1024x546.png)
![图片[3]-内网使用Lucky STUN+CF301重定向 实现纯域名不加端口号301P2P访问-小陈折腾日记](https://www.geekxw.top/wp-content/uploads/2024/08/Clip_20240801_191134.png)
https://dash.cloudflare.com/api/v4/zones/{区域ID}/rulesets/{规则集ID}/rules/{规则ID}
把https://dash.cloudflare.com/api/v4/zones替换成https://api.cloudflare.com/client/v4/zones
https://api.cloudflare.com/client/v4/zones/{区域ID}/rulesets/{规则集ID}/rules/{规则ID}
请求方法PATCH
![图片[4]-内网使用Lucky STUN+CF301重定向 实现纯域名不加端口号301P2P访问-小陈折腾日记](https://www.geekxw.top/wp-content/uploads/2024/09/Clip_20240927_201554-1024x811.png)
请求头
Authorization: Bearer 你的API令牌
请求主体
{
"action": "redirect",
"expression": "(http.host eq \"你的域名\")",
"description": "规则名称",
"action_parameters": {
"from_value": {
"status_code": 301,
"target_url": {
"expression": "concat(\"http://#{ipAddr}\", http.request.uri.path)"
},
"preserve_query_string": true
}
}
}
"success": true
![图片[5]-内网使用Lucky STUN+CF301重定向 实现纯域名不加端口号301P2P访问-小陈折腾日记](https://www.geekxw.top/wp-content/uploads/2024/08/Clip_20240801_193224-829x1024.png)
- 最新
- 最热
只看作者