satoshinm / WebSandboxMC

Bukkit plugin providing a web-based interface with an interactive WebGL 3D preview or glimpse of your server 🕷⏳📦 ⛺
https://www.spigotmc.org/resources/websandboxmc.39415/
MIT License
19 stars 5 forks source link

[WS] SSL server support (secure websockets, wss://) #80

Closed satoshinm closed 7 years ago

satoshinm commented 7 years ago

To support hosting the page on HTTPS servers, which cannot connect to insecure WebSocket servers (see related problem: https://www.spigotmc.org/threads/thinkmap.13782/page-7#post-2442256), it would be nice to support secure websockets.

The main problem with this is configuring a certificate. Consider allowing the user to configure manually and/or integrate https://github.com/shred/acme4j

satoshinm commented 7 years ago

This can be accomplished using a proxy server such as: https://www.digitalocean.com/community/tutorials/how-to-host-a-website-with-caddy-on-ubuntu-16-04 with /etc/caddy/Caddyfile:

example.com {
    root /var/www
    gzip
    tls example@example.com
    proxy / localhost:4081 {
        websocket
    }
}

then connecting with a full wss:// URL, example: https://449-87007603-gh.circle-artifacts.com/0/tmp/artifacts/wasm-build/craftw.html#wss://netcraft.beerprojects.com/craftws