Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ws:// while on https:// (mixed content)

I have a html5 page with

var connection = new WebSocket('ws://foo.bar:8888');

But I get an error

Mixed Content: The page at 'https://foo.bar/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://foo.bar:8888/'. This request has been blocked; this endpoint must be available over WSS.

I understand that, but I can't serve a Secure Websocket. Is there any way to make this work, except starting chrome with --allow-running-insecure-content or something like that, where the user has to do something?

Thanks!

like image 296
CodingKiwi Avatar asked May 21 '26 18:05

CodingKiwi


1 Answers

So months later I can say: If you can serve the page via https somewhere on your server there are certificate and chain files, use these to serve a wss

like image 81
CodingKiwi Avatar answered May 24 '26 07:05

CodingKiwi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!