https://siteA.com
에서 https://siteB.com
으로 연결을 열려고하는데, 두 서버가 http에서 https 로의 nginx 역방향 프록시 전달 뒤에있는 Meteor의 DDP.connect()
을 사용합니다.리버스 프록시 뒤에 원격 Meteor 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 config를 proxy_pass https://localhost:3000
으로 변경하면 502 Bad Gateway
이됩니다.
나는 siteB에 Meteor의 force-ssl
패키지가 있거나없는 것들을 시도했다.
내 사이트에는 Meteor의 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 설정이 있습니까? 어떤 도움을 주셔서 감사합니다. 여기에 몇 가지 초기 인터넷 검색 작은 힌트 후