【问题标题】:CGI on Heroku sock=backend (H18) errorHeroku 袜子上的 CGI=后端(H18)错误
【发布时间】:2016-03-11 12:52:05
【问题描述】:

我一直在尝试在 heroku 上运行 CGI 脚本,但没有成功。

我已遵循此回复中的建议:

Run Python CGI Application on Heroku

(通过编辑 procfile 来运行 python CGI 服务器),但是我从 heroku 日志中得到一个 H18 错误。这是错误:

2015-12-07T00:33:49.452384+00:00 heroku[router]: sock=backend at=error code=H18 desc="Server Request Interrupted" method=GET path="/cgi-bin/dilaps.cgi" host=blooming-beyond-1824.herokuapp.com request_id=a53e612c-1148-4f62-93fe-737aaee5af1d fwd="58.96.22.170" dyno=web.1 connect=1ms service=1170ms status=503 bytes=11383

这究竟是什么意思,我该如何解决?没有其他错误发生。

这是我的目录结构,以防万一。

Procfile
jobs -> *txt files
setup.py
cgi-bin -> dilaps.cgi
js -> *js files
css -> *css files
requirements.txt

【问题讨论】:

    标签: python heroku cgi


    【解决方案1】:

    这是我遇到的一个问题:Heroku 的 HTTP 路由器对标头中的回车是严格的,而我的浏览器是宽松的。所以我的脚本在测试期间可以工作,但在 Heroku 上不行。

    所以这个脚本起作用了:

    #!/bin/sh
    printf 'Content-Type: text/plain\r\n'
    printf '\r\n'
    echo "hello world"
    

    ...这个脚本因 H18 失败:

    #!/bin/sh
    echo "Content-Type: text/plain"
    echo
    echo "hello world"
    

    【讨论】:

      猜你喜欢
      • 2014-12-25
      • 2014-06-18
      • 1970-01-01
      • 2017-11-18
      • 2016-11-23
      • 2021-03-25
      • 2021-01-28
      • 1970-01-01
      • 2013-09-30
      相关资源
      最近更新 更多