rustdesk-api-server icon indicating copy to clipboard operation
rustdesk-api-server copied to clipboard

WebUI attempts to use ws instead of a wss connection on https

Open 1-tempest opened this issue 1 year ago • 6 comments

It seems that the websockets being used are only ws. If I attempt to use a secure connection (https), it requires that the websocket is wss.

1-tempest avatar Apr 27 '24 14:04 1-tempest

It seems that the websockets being used are only ws. If I attempt to use a secure connection (https), it requires that the websocket is wss.

You got it working? I can't get it to work with my self-hosted instance.

There's a statement here:

https://github.com/kingmo888/rustdesk-api-server/blob/master/README_EN.md

The web control terminal currently only supports non-SSL mode. If the webui is accessed via https, remove the 's', otherwise ws cannot connect and keeps spinning. For example: https://domain.com/webui, change to http://domain.com/webui

I tried the different options listed below. Let me know what I did wrong please.

ID_SERVER = os.environ.get("ID_SERVER", 'myhost.com') ID_SERVER = os.environ.get("myhost.com') ID_SERVER = 'myhost.com' ID_SERVER = ("ID_SERVER", 'myhost.com') ID_SERVER = ("myhost.com")

khat17 avatar May 04 '24 15:05 khat17

Honestly I haven't tried too hard to get it going. It was something I noticed while evaluating it, and it was a clear message within the chrome dev tools.

I just stated the issue so someone could address it if they felt like it

1-tempest avatar May 04 '24 15:05 1-tempest

So I spent a minute on it today. If you modify the index file located in static/web_client/module/ and replace "ws:/" with "wss:/" then I believe https works as expected.

1-tempest avatar May 06 '24 16:05 1-tempest

So I spent a minute on it today. If you modify the index file located in static/web_client/module/ and replace "ws:/" with "wss:/" then I believe https works as expected.

If you can ensure compatibility under both HTTP and HTTPS, please submit a PR.

kingmo888 avatar May 07 '24 06:05 kingmo888

That's the issue, one version will not work for both. This needs to be a variable within the setup, or add some logic to modify it to ws or wss based on if the string is http or https.

If you make the url https:// then we need it to be wss://, however if the url is http:// then we need it to be ws://.

@kingmo888 my apologies, I didn't get a notification to your response

1-tempest avatar May 14 '24 13:05 1-tempest

That's the issue, one version will not work for both. This needs to be a variable within the setup, or add some logic to modify it to ws or wss based on if the string is http or https.

If you make the url https:// then we need it to be wss://, however if the url is http:// then we need it to be ws://.

@kingmo888 my apologies, I didn't get a notification to your response

I test your idea,But it's not work now beacuse rustdesk websocket server not support wss... Look like they don't want to add it...

  • https://github.com/rustdesk/rustdesk/discussions/6023#discussioncomment-8687562
  • https://github.com/rustdesk/rustdesk-server/discussions/352

MIKU-N avatar May 15 '24 06:05 MIKU-N

That's the issue, one version will not work for both. This needs to be a variable within the setup, or add some logic to modify it to ws or wss based on if the string is http or https. If you make the url https:// then we need it to be wss://, however if the url is http:// then we need it to be ws://. @kingmo888 my apologies, I didn't get a notification to your response

I test your idea,But it's not work now beacuse rustdesk websocket server not support wss... Look like they don't want to add it...

If Rustdesk server does not support WSS, then we have no choice. @MIKU-N @13th-tempest

kingmo888 avatar Jun 05 '24 12:06 kingmo888