title: WebSocket handshake authentication
body: <p>I have an angular 6 app &amp; python(django 2.0.6) back-end.
  Angular 6 app is deployed using AWS S3 &amp; CloudFront.</p>
  
  <p>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.)</p>
  
  <p>Websocket server located at subdomain: `api.site.com``</p>
  
  <p>i tried multiple ways to set cookies in angular 6 app, such as:</p>
  
  <pre><code>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=/`;
  </code></pre>
  
  <p>using <code>ngx-cookie-service</code>:</p>
  
  <pre><code>this.cookieService.set('Token', token, undefined, '/', 'api.site.com');
  this.cookieService.set('Token', token, undefined, '/');
  this.cookieService.set('Token', token);
  </code></pre>
  
  <p><code>token</code> is a JWT token.</p>
  
  <p>For all the cases above, <code>Token</code> cookie does not passed with the websocket handshake when the app is deployed. using <code>wss</code> protocol.
  angular 6 app runs under the domain <code>site.com</code> (=> <code>api</code> is a subdomain )</p>
  
  <p>Cloudfront behavior is set to pass all cookies.</p>
  
  <p>Please advice what can be a possible reason.</p>