【问题标题】:Absolute URI not allowed if server is not a proxy如果服务器不是代理,则不允许使用绝对 URI
【发布时间】:2018-01-11 19:21:00
【问题描述】:

今天我运行了一个已运行 100 次的 ansible 部署脚本,以对我支持的旧系统的阶段副本进行微小的日志记录更改。运行它后,我在尝试登录时收到上述错误消息。

Nginx 访问日志报错:

10.0.1.65 - foo [04/Aug/2017:01:07:57 +0000] "GET /girder/api/v1/user/authentication HTTP/1.1" 400 50 "http://bar-stage/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML,如 Gecko)Chrome/59.0.3071.115 Safari/537.36" "-"

系统正在运行一个名为 girder 的奇怪 Web 框架,但根据日志,该请求似乎从未到达 girder。我回滚了更改,系统仍然损坏。我在 dev 上重新测试了更改的代码,工作正常。我针对 dev 运行部署脚本,它基本上只是执行 git pull 并重新启动 girder,它破坏了 dev。生产和第二个(未更改的)开发服务器仍然可以正常工作。我们从基础镜像启动了一个全新的开发服务器,同样的错误。

有人知道发生了什么吗?

单次尝试的 nginx 调试日志:

2017/08/04 17:58:31 [debug] 2146#2146: *1 write new buf t:1 f:0 000055E4D62A8F58, pos 000055E4D62A8F58, size: 157 file: 0, size: 0
2017/08/04 17:58:31 [debug] 2146#2146: *1 http write filter: l:0 f:0 s:157
2017/08/04 17:58:31 [debug] 2146#2146: *1 http proxy filter init s:400 h:0 c:0 l:50
2017/08/04 17:58:31 [debug] 2146#2146: *1 tcp_nodelay
2017/08/04 17:58:31 [debug] 2146#2146: *1 http upstream process non buffered downstream
2017/08/04 17:58:31 [debug] 2146#2146: *1 http output filter "/girder/api/v1/user/authentication?"
2017/08/04 17:58:31 [debug] 2146#2146: *1 http copy filter: "/girder/api/v1/user/authentication?"
2017/08/04 17:58:31 [debug] 2146#2146: *1 http postpone filter "/girder/api/v1/user/authentication?" 000055E4D62A9008
2017/08/04 17:58:31 [debug] 2146#2146: *1 write old buf t:1 f:0 000055E4D62A8F58, pos 000055E4D62A8F58, size: 157 file: 0, size: 0
2017/08/04 17:58:31 [debug] 2146#2146: *1 write new buf t:0 f:0 0000000000000000, pos 000055E4D629ABCA, size: 50 file: 0, size: 0
2017/08/04 17:58:31 [debug] 2146#2146: *1 http write filter: l:0 f:1 s:207
2017/08/04 17:58:31 [debug] 2146#2146: *1 http write filter limit 0
2017/08/04 17:58:31 [debug] 2146#2146: *1 writev: 207 of 207
2017/08/04 17:58:31 [debug] 2146#2146: *1 http write filter 0000000000000000
2017/08/04 17:58:31 [debug] 2146#2146: *1 http copy filter: 0 "/girder/api/v1/user/authentication?"
2017/08/04 17:58:31 [debug] 2146#2146: *1 finalize http upstream request: 0
2017/08/04 17:58:31 [debug] 2146#2146: *1 finalize http proxy request
2017/08/04 17:58:31 [debug] 2146#2146: *1 free rr peer 1 0
2017/08/04 17:58:31 [debug] 2146#2146: *1 close http upstream connection: 11
2017/08/04 17:58:31 [debug] 2146#2146: *1 free: 000055E4D62B2E10, unused: 48
2017/08/04 17:58:31 [debug] 2146#2146: *1 event timer del: 11: 1501870111101
2017/08/04 17:58:31 [debug] 2146#2146: *1 reusable connection: 0
2017/08/04 17:58:31 [debug] 2146#2146: *1 http output filter "/girder/api/v1/user/authentication?"
2017/08/04 17:58:31 [debug] 2146#2146: *1 http copy filter: "/girder/api/v1/user/authentication?"
2017/08/04 17:58:31 [debug] 2146#2146: *1 http postpone filter "/girder/api/v1/user/authentication?" 00007FFC3E69E320
2017/08/04 17:58:31 [debug] 2146#2146: *1 write new buf t:0 f:0 0000000000000000, pos 0000000000000000, size: 0 file: 0, size: 0
2017/08/04 17:58:31 [debug] 2146#2146: *1 http write filter: l:1 f:0 s:0
2017/08/04 17:58:31 [debug] 2146#2146: *1 http copy filter: 0 "/girder/api/v1/user/authentication?"
2017/08/04 17:58:31 [debug] 2146#2146: *1 http finalize request: 0, "/girder/api/v1/user/authentication?" a:1, c:1
2017/08/04 17:58:31 [debug] 2146#2146: *1 set http keepalive handler
2017/08/04 17:58:31 [debug] 2146#2146: *1 http close request
2017/08/04 17:58:31 [debug] 2146#2146: *1 http log handler
2017/08/04 17:58:31 [debug] 2146#2146: *1 posix_memalign: 000055E4D629BB90:4096 @16
2017/08/04 17:58:31 [debug] 2146#2146: *1 free: 000055E4D629AB80
2017/08/04 17:58:31 [debug] 2146#2146: *1 free: 000055E4D62B7EF0, unused: 8
2017/08/04 17:58:31 [debug] 2146#2146: *1 free: 000055E4D62A8230, unused: 224
2017/08/04 17:58:31 [debug] 2146#2146: *1 free: 000055E4D629BB90, unused: 3797
2017/08/04 17:58:31 [debug] 2146#2146: *1 free: 000055E4D62B2A00
2017/08/04 17:58:31 [debug] 2146#2146: *1 hc free: 0000000000000000
2017/08/04 17:58:31 [debug] 2146#2146: *1 hc busy: 0000000000000000 0
2017/08/04 17:58:31 [debug] 2146#2146: *1 reusable connection: 1
2017/08/04 17:58:31 [debug] 2146#2146: *1 event timer add: 3: 65000:1501869576102
2017/08/04 17:58:31 [debug] 2146#2146: timer delta: 1
2017/08/04 17:58:31 [debug] 2146#2146: worker cycle
2017/08/04 17:58:31 [debug] 2146#2146: epoll timer: 65000

【问题讨论】:

  • 检查error.log。如果需要,在调试模式下使用 error_log

标签: nginx cherrypy


【解决方案1】:

谜团解开了,有点。

Girder 依赖于CherryPy。 CherryPy 依赖于包 Cheroot。由于某些原因,Cheroot 没有出现在我们的 pip freeze 中,所以我们没有固定它,或者注意到它发生了变化。 ansible 脚本将其更新到最新版本,从 5.7.0 到 5.8.0,由于某些原因不适用于我们的设置和 nginx。它确实适用于Apache,我们昨晚将其作为短期修复工作。

我希望这对某人有所帮助。

【讨论】:

  • 请向our GitHub repo报告此类问题。此更改由 Waitress 的维护者发送给我们,并实现了 RFC 7230 和 RFC 7231。我已经修复了它导致的一些问题,但它似乎破坏了与 cherrypy 的一些兼容性。您能否分享您的工作/非工作反向代理配置,以便我可以尝试用测试套件覆盖它?
  • 是的,我也在计划周一上班。只是没有时间试图找出问题出在哪里。
  • 请检查您的 HTTP 流量,该流量来自 CherryPy 应用程序。我猜,在请求行中有包含绝对 URI 形式的 HTTP 查询,这仅适用于 HTTP 代理,否则无效。
  • 我还在等待细节,对我来说重要的是要解决任何不兼容问题。
  • 根据Gitter comment,nginx 配置的问题可能是在proxy_pass 指令值中缺少斜杠。
猜你喜欢
  • 2018-06-15
  • 1970-01-01
  • 1970-01-01
  • 2020-02-21
  • 2021-06-26
  • 2018-11-04
  • 2016-09-29
  • 2020-09-26
  • 1970-01-01
相关资源
最近更新 更多