【问题标题】:Why responses my heroku hosted container app with "Not authoritative"为什么用“不权威”响应我的 heroku 托管容器应用程序
【发布时间】:2021-01-06 05:48:32
【问题描述】:

我尝试在Heroku 中将my simple Web-App 作为Docker 容器运行。 在本地构建和运行容器时一切正常。

但是在访问生成的端点 https://html5-landingpage-buddah.herokuapp.com/ Heroku 时响应 HTTP 400 Bad Request 和消息“Not authoritative”

Heroku 中的日志没有多大帮助:

2020-09-19T14:45:45.269487+00:00 heroku[router]: at=info method=GET path="/" host=html5-landingpage-buddah.herokuapp.com request_id=5f07ea7e-d925-4fbe-b7ba-29387a3284cc fwd="XX.XX.XX.XXX" dyno=web.1 connect=1ms service=1ms status=400 bytes=212 protocol=https

我对该错误进行了研究,但没有发现任何有用的信息。 同样在 Heroku 中重新创建应用程序、重命名 URL 并将应用程序移动到另一个区域也没有帮助。


这是从重启到网络应用第一次请求的日志:

2021-06-15T17:11:36.977277+00:00 heroku[web.1]: Starting process with command `./app`
2021-06-15T17:11:39.852345+00:00 app[web.1]: [main] INFO de.clique.westwood.example.html5.landingpage.buddah.App - Server started on port 54225
2021-06-15T17:11:39.852374+00:00 app[web.1]: [main] INFO de.clique.westwood.example.html5.landingpage.buddah.App - Serving albums from ./static/album
2021-06-15T17:11:41.363857+00:00 heroku[web.1]: State changed from starting to up
2021-06-15T17:11:48.162254+00:00 heroku[router]: at=info method=GET path="/" host=html5-landingpage-buddah.herokuapp.com request_id=85c642cb-a48d-41ac-89e1-7a520749e9bc fwd="94.31.82.142" dyno=web.1 connect=1ms service=4ms status=421 bytes=219 protocol=https
2021-06-15T17:11:48.275223+00:00 heroku[router]: at=info method=GET path="/" host=html5-landingpage-buddah.herokuapp.com request_id=406e9e77-f40e-47b9-a33b-af0af5b8f171 fwd="94.31.82.142" dyno=web.1 connect=1ms service=3ms status=421 bytes=219 protocol=https
2021-06-15T17:11:48.520876+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=html5-landingpage-buddah.herokuapp.com request_id=d3782734-765c-45f1-98a8-04e2098e7267 fwd="94.31.82.142" dyno=web.1 connect=1ms service=4ms status=421 bytes=219 protocol=https
2021-06-15T17:11:48.906097+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=html5-landingpage-buddah.herokuapp.com request_id=79e4404f-e505-4c16-9778-9f72882d74be fwd="94.31.82.142" dyno=web.1 connect=1ms service=4ms status=421 bytes=219 protocol=https

【问题讨论】:

  • 提供日志。从您第一次启动应用程序的那一刻到您打开网站的那一刻。您提供的日志与您的应用无关。这是router,而不是您的应用程序。另外提供build.log。

标签: docker kotlin heroku graalvm http4k


【解决方案1】:

错误Not Authoritative 仅表示Heroku 无法将流量从所述域名重定向到您的应用程序。

根据Heroku

Web 进程必须侦听由 Heroku 设置的 $PORT 上的 HTTP 流量。 Dockerfile 中的 EXPOSE 不受尊重,但可用于本地测试。仅支持 HTTP 请求。

您需要替换您的 EXPOSEENTRYPOINT

CMD [ "sh", "-c", "java -jar ./app --bind 0.0.0.0:$PORT" ]

【讨论】:

  • 使用您的解决方案,同样的问题仍然存在。请注意,我将我的 java 程序编译为本机可执行文件(请参阅链接的 git 存储库中的 dockerfile)。因此,我将您的命令更改为: CMD [ "sh", "-c", "./app --bind 0.0.0.0:$PORT" ] 这与当前版本中的相同,这在我的机器上运行良好。但是部署在 Heroku 上会出现同样的错误。
  • 这里是日志 heroku[web.1]:使用命令sh -c ./app\ --bind\ 0.0.0.0:\17829 app[web.1] 启动进程:[main] INFO de.clique.westwood.example.html5.landingpage.buddah。应用程序 - 服务器在端口 17829 上启动 app[web.1]: [main] INFO de.clique.westwood.example.html5.landingpage.buddah.App - 提供来自 ./static/album heroku[web.1] 的专辑:状态从开始更改为向上 heroku[路由器]:at=info method=GET path="/" host=html5-landingpage-buddah.herokuapp.com request_id=5b509c13-9ea9-45d3-8d95-129c2470f2b6 fwd="4.3.2.1" dyno=web.1 连接=1ms 服务=2ms 状态=421 字节=219 协议=https
猜你喜欢
  • 1970-01-01
  • 2012-09-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-17
  • 2019-11-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多