docker - 为什么用“不权威”响应我的 heroku 托管容器应用程序
问题描述
我尝试在Heroku中将我的简单 Web-App作为 Docker Container运行。在本地构建和运行容器时一切正常。
但是在访问生成的端点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的说法,
Web 进程必须侦听
$PORT
由 Heroku 设置的 HTTP 流量。EXPOSE
inDockerfile
不被尊重,但可以用于本地测试。仅支持 HTTP 请求。
您将需要更换您的EXPOSE
和ENTRYPOINT
CMD [ "sh", "-c", "java -jar ./app --bind 0.0.0.0:$PORT" ]
推荐阅读
- oracle-apex - 如何在 Oracle APEX 中实现拖放导入功能?
- java - 如何通过 Spring Boot 获取 mongoDB 中的计数?
- javascript - 使用 parse-server 云代码进行 facebook 身份验证
- react-native - React Native 中的实时权限
- php - 返回营业时间,午夜过后
- java - 收到的 Java 已启动但在 64 位机器上启动 STS 时返回退出代码 = 13 错误
- android - 我的 Gradle 正在检测多个 appCompat 版本
- corda - 在 Corda Enterprise 3 上运行网络引导程序时出错
- css - 使用CSS的角落附近的边框宽度不均匀
- php - 无法重新声明自定义方法