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

Connection aborted due to invalid data in the socket in Firefox #474

Closed
miketaylr opened this issue Apr 11, 2019 · 9 comments
Closed

Connection aborted due to invalid data in the socket in Firefox #474

miketaylr opened this issue Apr 11, 2019 · 9 comments

Comments

@miketaylr
Copy link

This bug was filed @ https://bugzilla.mozilla.org/show_bug.cgi?id=1536843 and also facebook/create-react-app#6720, but it seems like the bug is here in sockjs-client (I think?).

There's STR in https://bugzilla.mozilla.org/show_bug.cgi?id=1536843#c0.

It shows that the websocket handshake is successful, few frames are received, but then the connection is aborted due to invalid data in the socket.

In the end, I was able to reproduce it and mozregression pointed to a bug 1417463. That bug changed default accept header and further testing showed that it's server side issue. For some reason, server goes mad when "text/html" is missing in the accept header and after few frames it sends some unexpected HTTP response over the websocket connection.

I.e. this bug happens in Firefox 65 too when text/html is removed from network.http.accept.default pref in about:config.

@brycekahle
Copy link
Contributor

@miketaylr Those comments seem to indicate a server issue? If that is correct, it is not a bug in sockjs-client.

@daliusd
Copy link

daliusd commented Apr 13, 2019

Yes, I think this might be webpack-dev-server issue, but I'm not sure.

@alexander-akait
Copy link

@brycekahle Nope, problem here

@brycekahle
Copy link
Contributor

@evilebottnawi Please explain. The comments above clearly reference a "server side issue", which would not be the JS client.

@dmile
Copy link

dmile commented Apr 14, 2019

Connection aborted because webpack-dev-server trying to proxy sockjs request

  1. When proxy enabled webpack-dev-server uses http-proxy-middleware
  2. http-proxy-middleware checks every request with shouldProxy and result depends on proxy context
  3. Default proxy context defined in react-dev-utils and rely on accept header
  4. The header is different for browsers

Firefox 65.0.2
Firefox 65.0.2
Firefox 66.0.3
Firefox 66.0.3

Hope it helps.

@dmile
Copy link

dmile commented Apr 14, 2019

Interesting that Safari doesn't send accept header at all.
In that case context / sholdProxy becomes undefined and works fine in if condition with enabling HPM stuff 🙂

@brycekahle
Copy link
Contributor

@dmile Thanks for the info. That seems to indicate the problem lies in react-dev-utils then. Would you agree?

@dmile
Copy link

dmile commented Apr 15, 2019

It's an integration issue. But I agree, react-dev-utils is a place where it occurs.

@brycekahle
Copy link
Contributor

I'm going to close this issue since the problem lies elsewhere.

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

No branches or pull requests

5 participants