V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
SimonOne

cloudflare tunnel 怎么将本地的 http 代理服务穿透出去?

  •  
  •   SimonOne · Sep 27, 2023 · 2770 views
    This topic created in 949 days ago, the information mentioned may be changed or developed.

    因为 frpc 有时候被 defender 误杀,所以昨天在研究怎么换成 cloudflare tunnel 玩玩。

    cloudflared tunnel route dns <隧道名> <托管二级域名>
    cloudflared tunnel run --url http://127.0.0.1:5000 <隧道名>
    

    可以把本地的 http 网站 http://127.0.0.1:5000 穿透,访问<托管二级域名>可以看到。

    但是我改成 surge 的 HTTP 代理服务 127.0.0.1:6152 ,在想要使用代理的客户端中输入<托管二级域名>:80 ,代理就不通。

    请问玩过的 V 友,还需要做什么吗?

    8 replies    2025-06-15 12:34:32 +08:00
    itlaohui
        1
    itlaohui  
       Sep 27, 2023
    试试 cloudflared tunnel 转发 TCP 协议呢
    SimonOne
        2
    SimonOne  
    OP
       Sep 27, 2023
    @itlaohui #1 试了下 tcp 的还是不通。
    谷歌了下,似乎 cli 配制隧道的方式有一些 bug ,cf 不修呢,比如 https://github.com/cloudflare/cloudflared/issues/327
    我打算用 dashboard 配制隧道看看
    titanium98118
        3
    titanium98118  
       Sep 28, 2023
    现在用 dashboard 傻瓜式配置就好,很简单。
    SimonOne
        4
    SimonOne  
    OP
       Sep 28, 2023
    @titanium98118 #3 痛苦的是,我用 dashboard 的时候,用 http 127.0.0.1:6152 和 tcp 127.0.0.1:6152 不能将代理直接转发出去。我查了一些资料,似乎是除了网页可以直接访问,别的得在客户端上装 cloudflared 才行。不知道是不是这个原因。还得继续鼓捣。
    6Bpencle
        5
    6Bpencle  
       Sep 28, 2023   ❤️ 1
    非 web 得在对应客户端装 cloudflared 程序,然后执行 cloudflared access "通讯协议" --hostname "域名" --url "协议://localhost:端口"
    SimonOne
        6
    SimonOne  
    OP
       Sep 28, 2023
    @6Bpencle 也就是说,软件在客户端将流量解密转成本地的端口服务是吗,然后我就可以用这个本地的端口去使用了,对吗
    6Bpencle
        7
    6Bpencle  
       Sep 29, 2023
    @SimonOne 对的
    liuweiqing
        8
    liuweiqing  
       Jun 15, 2025
    我还是不成功
    @6Bpencle
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2345 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 05:11 · PVG 13:11 · LAX 22:11 · JFK 01:11
    ♥ Do have faith in what you're doing.