简体   繁体   English

Heroku 上的 express-gateway - {$PORT} 绑定错误

[英]express-gateway on Heroku - {$PORT} binding error

I have deployed my express-gateway on Heroku, using env variables in this way in the gateway.config.yml file:我已经在 Heroku 上部署了我的 express-gateway,在gateway.config.yml文件中以这种方式使用环境变量:

http:
  port: ${PORT:-8080}
  host: ${HOST:-localhost} 
https:
  port: ${PORT:-8080}
  host: ${HOST:-localhost}   
apiEndpoints:
  ....

Anyway Heroku keeps giving this error:无论如何,Heroku 不断给出这个错误:

[EG:gateway] gateway http server listening on :::8080

State changed from starting to crashed

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

I have used the notation ${ENV_VAR_NAME:-DEFAULT} according to official documentation .根据官方文档,我使用了${ENV_VAR_NAME:-DEFAULT}符号。 Why Heroku tries to bind the 8080?为什么 Heroku 试图绑定 8080?

You should not make listen both the http and the https server on the same port, otherwise it's going to fail.你不应该在同一个端口上同时监听 http 和 https 服务器,否则它会失败。

Heroku provides its own router handling the SSL termination for you, so you can just remove the whole https section. Heroku 为您提供了自己的路由器来处理 SSL 终止,因此您可以删除整个https部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM