Posts

Showing posts with the label websocket

WebSocket handshake cookies cloudfront deployment

Image
Clash Royale CLAN TAG #URR8PPP WebSocket handshake cookies cloudfront deployment I have an angular 6 app & python(django 2.0.6) back-end. Angular 6 app is deployed using AWS S3 & CloudFront. Angular 6 app use websocket functionality. Everything works well locally, but when deployed Angular 6 app fails to pass a cookies with websocket handshake request. (Authorization is by cookies only for websoket connection. There are reasons for that, not relevant.) Websocket server located at subdomain: `api.site.com`` i tried multiple ways to set cookies in angular 6 app, such as: let domain = 'api.site.com' document.cookie = `Token=${token}; domain=${domain}; path=/`; document.cookie = `Token=${token}; path=/`; document.cookie = `Token=${token}; document.cookie = `Token=${token}, domain=${domain}, path=/`; using ngx-cookie-service : ngx-cookie-service this.cookieService.set('Token', token, undefined, '/', 'api.site.com'); this.cookieService.set('Token...

How to forward web-socket request to microservice using nginx

Image
Clash Royale CLAN TAG #URR8PPP How to forward web-socket request to microservice using nginx I wanted to forward the web-socket request to microservice using nginx. I am hitting https://some-host/download-zip-service/downloadFile https://some-host/download-zip-service/downloadFile By this, the calls are landing on download-zip-service and downloadFile API get the call. but when I tried to call socket API in download-zip-service I do something like var socket = io('https://some-host/download-zip-service/'); var socket = io('https://some-host/download-zip-service/'); the calls are directly landing on wss://some-host/socket.io/?EIO=3&transport=websocket&sid=12345678 wss://some-host/socket.io/?EIO=3&transport=websocket&sid=12345678 instead of https://some-host/download-zip-service/socket.io/?EIO=3&transport=websocket&sid=12345678 https://some-host/download-zip-service/socket.io/?EIO=3&transport=websocket&sid=12345678 as a reason, I expl...