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

Safari 17 Does Not Load WebSockets, TTYD 1.7.4 (ARM) Will Not Load #1293

Closed
hazarjast opened this issue Jan 30, 2024 · 8 comments
Closed

Safari 17 Does Not Load WebSockets, TTYD 1.7.4 (ARM) Will Not Load #1293

hazarjast opened this issue Jan 30, 2024 · 8 comments
Labels

Comments

@hazarjast
Copy link

Describe the bug
Safari 17 on macOS Sonoma will not load WebSockets so it cannot connect to TTYD.
The cause seems to be Apple's forcing of the NSURLSession in Safari for WebSocket connections.

To Reproduce
Steps to reproduce the behavior:

  1. Execute ttyd to run bash or simple shell script with all ttyd defaults.
  2. Attempt to connect to the host running ttyd via IP address.
  3. Safari will load only a blank screen with cursor and will continue to load until timeout.

Expected behavior
The full bash or script called by ttyd should load via WebSocket connection.

Screenshots
image
image

Environment:

  • OS: macOS 14.0 Sonoma
  • Browser: Safari 17.0
  • TTYD: 1.7.4 (ARM Build)

Additional context
In earlier versions of Safari it was possible to turn off NSURLSession WebSockets but as of 17.0 it is no longer possible to disable as there is no Feature Flag for it. Chrome and Firefox load the session just fine.

@hazarjast hazarjast added the bug label Jan 30, 2024
@tsl0922
Copy link
Owner

tsl0922 commented Feb 9, 2024

Then why it is not a Safari bug?

@hazarjast
Copy link
Author

hazarjast commented Feb 9, 2024 via email

@tsl0922
Copy link
Owner

tsl0922 commented Feb 9, 2024

If you can reproduced it with: https://libwebsockets.org/testserver, report it to: https://github.com/warmcat/libwebsockets

@hazarjast
Copy link
Author

hazarjast commented Feb 9, 2024 via email

@hazarjast
Copy link
Author

Looking at other projects which have hit this issue, it seems a workaround may be to disable compression in the WebSocket session: coder/coder#8087 .

Is such a workaround possible with TTYD's use of LibWebSockets? Please let me know if there is anything I can do to help test. Thank you!

I have reported the issue here to LibWebSockets as well, as you indicated: warmcat/libwebsockets#3065 .

@tsl0922
Copy link
Owner

tsl0922 commented Feb 9, 2024

if you build ttyd with libwebsockets that compiled with LWS_WITHOUT_EXTENSIONS=ON, then ttyd will not use compression.

@hazarjast
Copy link
Author

if you build ttyd with libwebsockets that compiled with LWS_WITHOUT_EXTENSIONS=ON, then ttyd will not use compression.

I have used your provided 'cross-build.sh' to compile without extensions as instructed but the resulting TTYD binary shows the same behavior with Safari (i.e. timeout when trying to connect). I notice that on the older Safari versions when it was working the 'Sec-WebSocket-Extensions' listed 'x-webkit-deflate-frame' vs. 'permessage-deflate' which the non-working Safari 17 shows. Not sure if this is significant or not. No movement yet on the bug report submitted to LWS.

@hazarjast
Copy link
Author

hazarjast commented Feb 13, 2024

Spent more time testing this between Safari versions on different configurations and found that Safari 17.x seems to only have issues connecting to an WebSocket session when there is a proxy being used between Safari and TTYD (whether it be SSL or just plain HTTP). On older Safari versions (15.x/16.x/17.x) in this proxy scenario, turning off NSURLSession WebSocket (under 'Experimental Features') allows TTYD to load as expected so there still seems to be some issue between this and LWS. However, since I can get Safari 17.x TTYD connections to work by removing the proxy from my scenario that will work until I can spend more time figuring out why NSURLSession WebSocket under Safari seems to break proxied/tunneled WebSocket sessions.

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

No branches or pull requests

2 participants