kingmo888 / rustdesk-api-server

基于Django的RustDesk Api&Web Server,除了支持api所有功能,还支持web注册、管理、展示等。已支持到最新1.2.3版本。
491 stars 114 forks source link

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

Closed 13th-tempest closed 1 month ago

13th-tempest commented 3 months ago

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.

khat17 commented 2 months ago

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")

13th-tempest commented 2 months ago

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

13th-tempest commented 2 months ago

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.

kingmo888 commented 2 months ago

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.

13th-tempest commented 2 months ago

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

MIKU-N commented 2 months ago

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...

kingmo888 commented 1 month ago

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