我很努力地使用流星的DDP.connect()
打开从https://siteA.com
到https://siteB.com
的连接,其中两台服务器都位于nginx反向代理之后,从http转发到https。打开远程流星DDP连接反向代理后面
事情在开发中工作正常。在生产中,当我在站点A的控制台运行DDP.connect('siteB.com')
,我收到:
Mixed Content: The page at 'https://siteA.com/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://siteB.com/sockjs/info?cb=zw6j36l90y'. This request has been blocked; the content must be served over HTTPS.
在为站点B我目前nginx的配置,我有以下的(相关部分,LMK如果有更多的要求):
server {
listen 80 default_server;
location/{
rewrite^https://$server_name$request_uri? permanent;
}
}
server {
listen 443 ssl spdy;
add_header Access-Control-Allow-Origin 'https://siteA.com';
proxy_pass http://localhost:3000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
我得到它抱怨说请求在一个http端点(http://localhost:3000)终止,但我不知道该怎么办。
如果我将siteB的nginx配置更改为proxy_pass https://localhost:3000
,则结果为502 Bad Gateway
。
我已经尝试过使用和不使用流星的force-ssl
包在siteB上的事情。
这两个网站都不包括流星的browser-policy
包 - 根据我的阅读,默认设置没有包应该允许我连接到任何地方。
我也试过DDP.connect("ws://siteB.com");
,但是这导致:
XMLHttpRequest cannot load ws://siteB.com/sockjs/info?cb=9lahswe7_9. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
我应该在不同的端口上监听?是否有一个nginx配置设置白名单这个请求?任何帮助表示赞赏。