V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
yaott2020
V2EX  ›  问与答

Nginx 反向代理 Golang HTTP 报错

  •  
  •   yaott2020 · 290 天前 · 404 次点击
    这是一个创建于 290 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Nginx 反向代理 Golang HTTP 报错:

    http: wrote more than the declared Content-Length
    

    Nginx 配置如下:

        location / {
            proxy_pass          http://127.0.0.1:6003;
            proxy_set_header    Host            $http_host;
            proxy_set_header    X-Real-IP       $remote_addr;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_redirect      off;
        }
    

    有哪位 v 友遇到过,该如何解决

    5 条回复    2023-07-25 09:02:52 +08:00
    julyclyde
        1
    julyclyde  
       288 天前
    这句错误信息是 nginx“产生”的,还是 nginx 从 golang 那边转发过来的?
    yaott2020
        2
    yaott2020  
    OP
       288 天前 via Android
    @julyclyde golang 报错,nginx 给浏览器返回了 404
    julyclyde
        3
    julyclyde  
       282 天前
    @yaott2020 那应该 500 才对
    你别自己理解了,直接发 nginx 的 access 和 error 日志看看吧
    yaott2020
        4
    yaott2020  
    OP
       282 天前 via Android
    @julyclyde error 没日志,access 就记了一条 404
    julyclyde
        5
    julyclyde  
       282 天前
    @yaott2020 设置一下 access 的格式,把 status 和 upstrem status 都记录下来
    看看 upstream status 是多少
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   753 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 21:36 · PVG 05:36 · LAX 14:36 · JFK 17:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.