rateltalk
V2EX  ›  问与答

同样的 url,浏览器访问超时(timeout), curl 访问访问正常、

  •  
  •   rateltalk · Aug 30, 2021 · 2406 views
    This topic created in 1761 days ago, the information mentioned may be changed or developed.

    使用 Nginx

    我有一个请求 json 数据的 url,数据量比较大,所以后台处理时时间比较长,大概 20s 左右。

    当在浏览器中请求该 url 时,总是返回 502 错误( nginx 访问日志中为 499 );

    在命令行中使用 curl 访问时,返回正常。

    由此推断,应该不是后端的问题,可能是客户端的问题?有没有解决的办法、

    Supplement 1  ·  Aug 30, 2021
    结贴:Clash for windows 代理引起的。
    7 replies    2021-09-07 16:27:55 +08:00
    rateltalk
        1
    rateltalk  
    OP
       Aug 30, 2021
    浏览器访问时,在第 10s 准时返回 502 错误(实际后台还在处理中)
    opengps
        2
    opengps  
       Aug 30, 2021
    curl 和浏览器多少有些差异,curl 直接访问页面能看到的不带 302 跳转等行为的结果,浏览器则对 302 有跳转,看到的最终结果。楼主顺着这个方向对比下,比如 wget 和 crul 的返回码
    eason1874
        3
    eason1874  
       Aug 30, 2021   ❤️ 3
    浏览器超时没这么断,比较大概率是浏览器跟服务器之间有一个代理

    代理在 20s 内主动中断了连接,所以 Nginx 收到 499 (客户端关闭),而浏览器收到的是 502 (网关出错)
    eason1874
        4
    eason1874  
       Aug 30, 2021
    #3 更正:浏览器超时没这么短。默认是分钟级别的。
    Telegram
        5
    Telegram  
       Aug 30, 2021
    先抓包看看,header 一样不
    对比一下看看有啥区别
    rateltalk
        6
    rateltalk  
    OP
       Aug 30, 2021
    @eason1874 你说的是对的。。一说代理,我突然想到 VPN,关掉 VPN 系统代理后,恢复正常、、、VPN 客户端是 Clash
    zjttfs
        7
    zjttfs  
       Sep 7, 2021
    赞... 我也这鬼问题...
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   904 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 19:33 · PVG 03:33 · LAX 12:33 · JFK 15:33
    ♥ Do have faith in what you're doing.