【发布时间】:2020-05-01 03:18:01
【问题描述】:
问题
我正在尝试在 Heroku 上托管一个用 Rust 编写的简单 HTTP 服务器。
我没有使用外部 HTTP 库,因为这是大学的学习项目,所以我通过 TcpStreams 管理所有内容。
服务器在本地按预期工作。
我一直在 Heroku 日志中看到 H18(服务器请求中断)错误,并且 Heroku 上正在运行的实例不提供任何文件。具体来说,会发生以下类型的错误:
2017-03-12T14:11:53.952084+00:00 heroku[router]: sock=backend at=error code=H18 desc="Server Request Interrupted" method=GET path="/" host=regans-rust-project.herokuapp.com request_id=fe50b113-8091-4129-99f5-632c9536bb8e fwd="154.126.208.8" dyno=web.1 connect=0ms service=2ms status=503 bytes=581 protocol=https
2017-03-12T14:11:54.459277+00:00 heroku[router]: sock=backend at=error code=H18 desc="Server Request Interrupted" method=GET path="/favicon.ico" host=regans-rust-project.herokuapp.com request_id=cf6ad8a0-2780-4c07-843a-2b533df1c9aa fwd="154.126.208.8" dyno=web.1 connect=0ms service=1ms status=503 bytes=388 protocol=https
我尝试过的
- 我已通过调用 Heroku 的 bash 实用程序确保静态资源位于目录中。我还从这里运行可执行文件,服务器也可以在本地从 Heroku 实例工作。
- 我已确保返回格式正确的 HTTP 响应(我有状态代码、内容类型、连接类型、内容长度)。
我的代码
你可以看到我的代码here。
我正在使用以下buildpack
还有什么我应该附加到我的回复中以“完成”它们吗?任何帮助将不胜感激:)
【问题讨论】:
-
尝试将生成的 http 响应中的所有“\n”替换为“\r\n”。
-
解决了!非常感谢!