godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.15k stars 21.19k forks source link

[WebSocketServer][SSL] WSS does not work #25558

Closed ghost closed 5 years ago

ghost commented 5 years ago

Godot version: 3.1.beta2

OS/device including version: Clientside : Gentoo Linux Kernel 4.20 / Serverside : Debian 9 Kernel 4.9

Issue description: When serving a HTML5 game on HTTPS, we must use secure websockets (wss:// instead of ws://). However, we can't just do this because nothing is happening on the server (the client browser is performing certificates verification but the godot linux server ignores it). How do you tell the godot server to start using TLS with a privatekey ? This seems unclear in the wiki because you can't just add the privatekey in a .crt file.

Error at this point Error in connection establishment ; net::ERR_SSL_PROTOCOL_ERROR

ghost commented 5 years ago

Update: Should I use a nginx proxy so that nginx handles TLS traffic and then redirect it to the godot server ?

ghost commented 5 years ago

Fixed by using 'proxy_pass' with nginx. See https://www.nginx.com/blog/websocket-nginx/

Ivan-Tigan commented 5 years ago

I am having the same issue as you with ws and wss. I spent quite a bit of time trying to understand how to fix it with nginx but I have not made much progress so I am wondering if you could give a few short step by step instructions on what exactly needs to be done to make a fresh nginx installation work with a websocket godot client and server? I am sure many other people will benefit as there doesn't seem to exist any information specifically on that topic. For example, I used these two tutorials: https://www.reddit.com/r/godot/comments/buphx4/tutorial_about_hosting_godot_server_via_google/
https://www.reddit.com/r/godot/comments/bux2hs/how_to_use_godots_high_level_multiplayer_api_with/?utm_source=share&utm_medium=web2x So now my godot server works fine on port 44444 with some ip given to me by the google virtual machine (works with ws but not wss). I am guessing you added/changed something in nginx.conf your server machine? If so could you please share it?

meruiden commented 5 years ago

When will this feature be added? really blocking from hosting a game on a https website and security ofcourse.