我尝试运行 my simple Web-App作为 Heroku 内的 Docker 容器.
在本地构建和运行容器时,一切正常。
但是在访问生成的端点时 https://html5-landingpage-buddah.herokuapp.com/ Heroku 响应 HTTP 400 错误请求和消息“不权威”
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 并将应用程序移动到另一个区域也无济于事。
这是从重新启动到 Web 应用程序上的第一个请求的日志:
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
最佳答案
错误 Not Authoritative
只是意味着 Heroku 无法将流量从所述域名重定向到您的应用程序。
根据 Heroku ,
The web process must listen for HTTP traffic on
$PORT
, which is set by Heroku.EXPOSE
inDockerfile
is not respected, but can be used for local testing. Only HTTP requests are supported.
您将需要更换您的
EXPOSE
和 ENTRYPOINT
像这样CMD [ "sh", "-c", "java -jar ./app --bind 0.0.0.0:$PORT" ]
关于docker - 为什么用 "Not authoritative"响应我的 heroku 托管容器应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63970138/