如何在没有部署到meteor.com子域的情况下在meteor.js中使用force-ssl?

时间:2012-11-26 01:33:54

标签: ssl meteor

该文件不清楚。如何在localhost中安装证书等?

force-ssl

This package causes Meteor to redirect insecure connections (HTTP) to a secure URL (HTTPS). Use this package to ensure that communication to the server is always encrypted to protect users from active spoofing attacks.

To simplify development, unencrypted connections from localhost are always accepted over HTTP.

Application bundles (meteor bundle) do not include an HTTPS server or certificate. A proxy server that terminates SSL in front of a Meteor bundle must set the standard x-forwarded-proto header for the force-ssl package to work.

Applications deployed to meteor.com subdomains with meteor deploy are automatically served via HTTPS using Meteor's certificate.

2 个答案:

答案 0 :(得分:4)

我已经开始设置一个在Meteor前面终止SSL的Apache反向代理,并希望在此处记录。

我将以下内容添加到SSL虚拟主机的配置文件中:

<VirtualHost _default_:443>
        ServerName server.domain.com

        ## SSL Engine Switch:
        # Enable/Disable SSL for this virtual host.
        SSLEngine on

        ## Proxy to port 3000 for Meteor apps
        SSLProxyEngine On
        ProxyRequests Off # Disable forward proxying
        ProxyPass / http://localhost:3000
        ProxyPassReverse / http://localhost:3000

        ## Your other SSL config directives such as certificates, etc.

</VirtualHost>

答案 1 :(得分:2)

您无需在localhost上安装证书。正如它所说的“为了简化开发,始终通过HTTP接受来自localhost的未加密连接。”这意味着您可以在不使用SSL且无需安装证书的情况下开发和测试应用程序。只需运行您的应用程序并像往常一样使用http://localhost:3000访问它。

如果您正在讨论为面向公众的应用程序安装证书,最好使用反向代理服务器(如nginx)并安装该服务器的证书。 http://wiki.nginx.org/HttpProxyModule