我已经通过gateway.config.yml
文件中的env变量在Heroku上部署了Express-gateway:
http:
port: ${PORT:-8080}
host: ${HOST:-localhost}
https:
port: ${PORT:-8080}
host: ${HOST:-localhost}
apiEndpoints:
....
无论如何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
我根据${ENV_VAR_NAME:-DEFAULT}
使用了符号official documentation。为什么Heroku试图绑定8080?
您不应该在同一端口上同时监听http和https服务器,否则它将失败。
Heroku为您提供了自己的路由器来处理SSL终止,因此您只需删除整个https
部分。