sherlock1122

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

  •  
  •   sherlock1122 · Dec 1, 2021 · 4106 views
    This topic created in 1799 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
    Solix
    Dec 1, 2021
    1
    换个固件?
    maichael
    maichael
    Dec 1, 2021
    2
    nginx 转一下?
    ghjexxka
    ghjexxka
    Dec 1, 2021
    3
    frp 客户端不是和路由器同一网段?
    cev2
    cev2
    Dec 1, 2021
    4
    以前帮人家远程设置过路由器,对方只有路由器和手机,没有电脑设备。
    cev2
    cev2
    Dec 1, 2021
    5
    点错了,没写完,让猫碰了回复了。
    当时是通过对方手机安装 APP 开启代理,通过 IPv6 走代理。结果发现,通过 http 代理无法打开路由器管理界面。但通过 socks 代理就可以正常打开。
    貌似是通过 http 代理路由器能检测出访问来源不是来自局域网,而通过 socks 代理路由器则认为访问来源是局域网内。
    keepeye
    keepeye
    Dec 1, 2021
    6
    frpc 的 http_proxy 插件能被检测出来吗
    delectate
    delectate
    Dec 1, 2021
    7
    其实我觉得这个安全策略没问题,如果称之为安全策略的话。

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

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