Closed satoshinm closed 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
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