uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.85k stars 570 forks source link

Safari permessage-deflate #76

Closed anton-piliugin closed 5 years ago

anton-piliugin commented 5 years ago

Hello. I'm having an issue with Safari both on mobile and desktop. Stackoverflow says that the problem is empty header sent by a server. I run SSLApp, with Let's Encrypt certificate

UPDATE: found a bug - compression set to 1 causes this issue, when i disable compression everything works beautifully

ghost commented 5 years ago

I think this is the Safari not supporting permessage-deflate bug. I think the solution was to call it something different. The old v0.14 solved it one time ago.

x-compress or something non-standard Apple-ishy

Vladislavik commented 5 years ago

i have same bug on Mac Safari, there is the error: WebSocket connection to 'ws://server.com/' failed: Invalid UTF-8 sequence in header value, safari need x-webkit-deflate-frame extension, need fix for it =)

mrlika commented 5 years ago

Looks like Safari doesn't support permessage-deflate but supports x-webkit-deflate-frame. Is it possible to not enable compression if there is no Sec-WebSocket-Extension: permessage-deflate in HTTP request headers?

ghost commented 5 years ago

It should be fixed now, let's wait for things to build and then npm install uNetworking/uWebSockets.js#binaries and check if it works

ghost commented 5 years ago

@mrlika The bug was that it sends an empty sec-websocket-extension header value because it failed to negotiate anything. It should not send anything if nothing was negotiated.

Adding support for x-webkit-deflate-frame as an alias to permessage-deflate could be a simple fix, but I rather see Apple fix their obscure browser :wink:

ghost commented 5 years ago

npm install uNetworking/uWebSockets.js#v15.3.0

See if it works

Vladislavik commented 5 years ago

yes, it is work, but work without deflate-frame now?

ghost commented 3 years ago

x-webkit-deflate-frame should be supported in latest version