在AWS Opsworks上设置使用SSL运行Meteor应用程序时出现问题

时间:2015-03-09 21:46:13

标签: node.js ssl meteor aws-opsworks

我的基本情况是我的Meteor App在Opsworks上完美运行。 我做一个流星build,调整文件,一切都很好(没有HTTPS / SSL)。我没有使用METEORUP。我只需上传我调整过的构建文件并在opsworks上部署。

另外,我正在使用开箱即用的Opsworks HAPROXY负载均衡器。

然后我为我的应用程序安装了SSL证书,并根据屏幕截图将Meteor设置为PORT=443列表:

enter image description here

在浏览器中,我看到:

503 Service Unavailable

No server is available to handle this request.

在日志文件中,我看到:

Mar  8 03:22:51 nodejs-app1 monit[2216]: 'node_web_app_buzzy' start: /bin/bash
Mar  8 03:23:51 nodejs-app1 monit[2216]: 'node_web_app_buzzy' failed, cannot ope
n a connection to INET[127.0.0.1:443/] via TCPSSL

欢迎任何想法

1 个答案:

答案 0 :(得分:0)

您的HAproxy配置期望meteor / node响应SSL。

它应该替代,终止SSL并在普通HTTP中与节点/流星交谈。这是因为,流星不会做SSL;它希望前面的服务器能够处理它。

解决方案: Update the frontend https-in section to terminate ssl and redirect to the http backend

defaults
   #... add this line to enable the `X-Forwarded-For` header
   option forwardfor
   # ... 

# .... update this section ...
frontend https-in
  mode tcp
  # this bit causes HAProxy to talk TLS rather than just forward the connection
  bind :443 ssl crt /path/to/your/certificate
  reqadd X-Forwarded-Proto:\ https
  # now direct it to your plain HTTP application
  acl nodejs_application_buzzy_domain_buzzy hdr_end(host) -i buzzy
  use_backend nodejs_app_servers if nodejs_application_buzzy_domain_buzzy
相关问题