Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket repeated disconnects by using sockjs@0.3.18 #699

Closed
6r1anchen opened this issue Nov 16, 2016 · 3 comments
Closed

WebSocket repeated disconnects by using sockjs@0.3.18 #699

6r1anchen opened this issue Nov 16, 2016 · 3 comments

Comments

@6r1anchen
Copy link

I'm submitting a bug report

webpack and webpack-dev-server version:
webpack: 2.1.0-beta.27
webpack-dev-server: >=2.1.0-beta.7

Please tell us about your environment:
OSX 10.x
Docker / Vagrant
Running server via CLI

Safari version: 10.0.1 (12602.2.14.0.7)

Current behavior:
using CLI webpack-dev-server -d --progress

with devServer config:

    https: true,
    host: '0.0.0.0',
    port: 9000,
    hot: true,
    inline: true,
    historyApiFallback: true

Expected/desired behavior:
Runnig webpack-dev-server on Safari should work as same as Chrome and Firefox

Current result:
Got WebSocket network error: OSStatus Error -9807 from Safari
WebSocket repeated disconnects.

I investigated a bit different beta version of webpack-dev-serve 2.0+, it seems like the issue caused by sockjs@0.3.18 to make secure WebSocket via SSL. I downgrade webpack-dev-server to 2.1.0-beta.6 then it works fine.

Any reason why after 2.1.0-beta.6, webpack-dev-server upgrade sockjs to 0.3.18 ?

@SpaceK33z
Copy link
Member

SpaceK33z commented Nov 17, 2016

Confirmed that the bug is happening on the latest beta. Will investigate, but all help is welcome.

@SpaceK33z
Copy link
Member

Investigated it a bit: this happens only when using http/2. If you'd set devServer.https.spdy.protocols = ["http/1.1"], it works fine on Safari. That's a temporary workaround you can use.

@SpaceK33z
Copy link
Member

SpaceK33z commented Nov 24, 2016

Hmm this is rather ugly, but it seems Safari doesn't "trust" the certificate used for the WebSocket, even if you click "Continue to untrusted page" when loading the page.

This article explains what you have to do to "trust" the certificate.

For future reference, here's a tl;dr:

  1. When Safari shows a modal that it can't verify the identity of the website, click on "Show Certificate".
  2. Next to "When using this certificate:", click on "Always Trust".

I verified that this fixed the issue. It is not a nice workaround, but unfortunately I see no other way to fix this behavior in webpack-dev-server (without breaking http/2). If anyone knows a better way, please don't hesitate to do a PR or comment here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants