WSS: //my.domain.com/sockjs/362/4q059yw7/websocket

I need help fixing this issue.

I am trying to implement ssl in my.domain.com

Front end of Angular and Backend is Meteor

I was able to correctly create ssl certificates and was able to load the Secure https shortcut when loading the domain, but the page did not appear due to an error

Uncaught TypeError: a._qs.unescape is not a function 

from assembly file to .build / dist / bundle / programs / web.browser

 Request URL:https://my.domain.com/5a0c202b90aa3cc1c9414b703c4e1f343fb0dd4e.js?meteor_js_resource=true 

Below websocket request will remain pending with status 101

 wss://my.domain.com/sockjs/362/4q059yw7/websocket 

I have not written any code on Meteor to run it in https, I am trying to process nginx. From Angular after adding ssl certificates trying to connect to the meteor via wss://localhost/ instead of ws://localhost:3000/

Please find my nginx file below.

 events { } http { server { listen 80; listen [::]:80 default_server ipv6only=on; server_name my.domain.com; root /client; index index.html; location / { rewrite ^ https://$server_name$request_uri? permanent; } } map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { # Enable HTTP/2 listen 443 ssl http2; listen [::]:443 ssl http2; server_name my.domain.com; root /client; index index.html; ssl_certificate /etc/letsencrypt/live/my.domain.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/my.domain.com/privkey.pem; # managed by Certbot ssl_dhparam /etc/ssl/certs/dhparam.pem; location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; # allow websockets proxy_set_header Connection $connection_upgrade; proxy_set_header X-Forwarded-For $remote_addr; } location /api { proxy_pass http://localhost:3000; } location /uploadFile { proxy_pass http://localhost:3000; } error_page 500 502 503 504 /50x.html; location = /51x.html { root /client; } } } 

Any findings would be appreciated.

0
javascript angularjs ssl nginx meteor
source share
1 answer

I understood the question that I had. The problem was below the line in nginx.

  proxy_pass http://localhost:3000; 

I fixed it by redirecting it to http://localhost:3000/websocket; and location as location /websocket

The snippet is below.

 location /websocket { proxy_pass http://localhost:3000/websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; # allow websockets proxy_set_header Connection $connection_upgrade; proxy_set_header X-Forwarded-For $remote_addr; } 
0
source share

All Articles