sherlock1122

frp 不能远程访问小米路由器页面

  •  
  •   sherlock1122 · Dec 1, 2021 · 3683 views
    This topic created in 1651 days ago, the information mentioned may be changed or developed.
    之前一直访问不了,也没有细究,以为是 frp 的问题。昨晚测试了一下,小米路由器严格检查 http 请求的 HOST 字段,如果是非局域网内的机器,就直接不响应了,或者响应重定向。

    ```
    root@OpenWrt:~# curl -H "Host: baidu.com:123" 192.168.50.1 -v
    > GET / HTTP/1.1
    > Host: baidu.com:123
    > User-Agent: curl/7.77.0
    > Accept: */*
    >

    直接卡住了……

    root@OpenWrt:~# curl -H "Host: 192.168.50.3" 192.168.50.1 -v
    > GET / HTTP/1.1
    > Host: 192.168.50.3
    > User-Agent: curl/7.77.0
    > Accept: */*
    >
    < HTTP/1.1 502 Bad Gateway
    < Server: nginx/1.12.2
    < Date: Wed, 01 Dec 2021 04:50:45 GMT
    < Content-Type: text/html; charset=UTF-8
    < Content-Length: 173
    < Connection: close

    root@OpenWrt:~# curl -H "Host: 192.168.50.2" 192.168.50.1 -v
    > GET / HTTP/1.1
    > Host: 192.168.50.2
    > User-Agent: curl/7.77.0
    > Accept: */*
    >
    < HTTP/1.1 403 Forbidden
    < Server: nginx/1.12.2
    < Date: Wed, 01 Dec 2021 04:54:37 GMT
    < Content-Type: text/html; charset=UTF-8
    < Transfer-Encoding: chunked
    < Connection: close
    < Cache-Control: no-cache
    < Pragma: no-cache
    < Expires: 0
    <
    <!DOCTYPE html>
    <html lang="zh-cn">
    <head>
    <meta charset="utf-8">
    <title>OpenWrt - LuCI</title>
    13 replies    2021-12-01 20:35:57 +08:00
    Solix
        1
    Solix  
       Dec 1, 2021
    换个固件?
    maichael
        2
    maichael  
       Dec 1, 2021
    nginx 转一下?
    ghjexxka
        3
    ghjexxka  
       Dec 1, 2021
    frp 客户端不是和路由器同一网段?
    cev2
        4
    cev2  
       Dec 1, 2021
    以前帮人家远程设置过路由器,对方只有路由器和手机,没有电脑设备。
    cev2
        5
    cev2  
       Dec 1, 2021
    点错了,没写完,让猫碰了回复了。
    当时是通过对方手机安装 APP 开启代理,通过 IPv6 走代理。结果发现,通过 http 代理无法打开路由器管理界面。但通过 socks 代理就可以正常打开。
    貌似是通过 http 代理路由器能检测出访问来源不是来自局域网,而通过 socks 代理路由器则认为访问来源是局域网内。
    keepeye
        6
    keepeye  
       Dec 1, 2021
    frpc 的 http_proxy 插件能被检测出来吗
    delectate
        7
    delectate  
       Dec 1, 2021
    其实我觉得这个安全策略没问题,如果称之为安全策略的话。

    可以用手机 app 操作,就用手机嘛。实在不行就找个台式机用向日葵操作吧。
    sherlock1122
        8
    sherlock1122  
    OP
       Dec 1, 2021
    @ghjexxka 同一个网段,看起来 frpc 是直接转发的 http 包,而不是解析包然后自己发一个 http 包。
    刚看了一下,我用的 type =tcp 模式,用 type=http 可能可以解决,有空再试试。
    kxy09
        9
    kxy09  
       Dec 1, 2021
    最近用的 ddns-go 应该也是,只能先代理到内网设备上再操作了
    swiftg
        10
    swiftg  
       Dec 1, 2021
    直接 IP 访问也有 Host 字段?
    maplejaw
        11
    maplejaw  
       Dec 1, 2021 via Android
    frp 支持重写 host 的,你文档翻翻,我之前的路由器搞过,现在换路由器,找不到配置了。
    blessyou
        12
    blessyou  
       Dec 1, 2021 via Android
    重写 host
    blessyou
        13
    blessyou  
       Dec 1, 2021   ❤️ 1
    frpc.ini 配置里加一行

    host_header_rewrite = miwifi.com
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4390 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 63ms · UTC 04:09 · PVG 12:09 · LAX 21:09 · JFK 00:09
    ♥ Do have faith in what you're doing.