hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

Mixed content with http source problem

Open popler opened this issue 10 years ago • 8 comments

I would like to use player on https website, but content should be loaded from unsecure http server (live stream). Is there any option (eg. Content Secure Policy) to load content? I'm receiving mixed-content errors.

popler avatar Apr 19 '16 18:04 popler

yes you should be able to workaround this using CSP header useful links here : https://developers.google.com/web/fundamentals/security/prevent-mixed-content/fixing-mixed-content#handle-mixed-content-at-scale

mangui avatar Apr 20 '16 09:04 mangui

Ok,thank you for info. But I'm not sure where I have to add additional CSP header. Should it be added in hls.js config? Could you give me some example?

popler avatar Apr 20 '16 10:04 popler

AFAIU, CSP cannot workaround mixed content errors when an HTTPS web page tries to fetch media data from an HTTP server. I would love to learn otherwise, though. :-)

cpeterso avatar Apr 20 '16 18:04 cpeterso

I still hope that it can work. It is working twitch.tv. There is warn in console but content is not blocked.

popler avatar Apr 20 '16 20:04 popler

Twitch's Flash streams work with HTTPS because the Flash Player doesn't block mixed content. Twitch's HTML5 streams (using HLS and MSE) don't work for me with HTTPS. A motivated individual could work around the mixed content blocking by tunneling an HTTPS web page's XHR requests through a Flash SWF to fetch HTTP media data. :) HLS.js has configuration hooks for writing custom loaders that could do fancy things like this.

  • HTTPS Flash: https://player.twitch.tv/?channel=monstercat
  • HTTPS HTML5: https://player.twitch.tv/?channel=monstercat&html5

cpeterso avatar Apr 20 '16 23:04 cpeterso

Ok, so there is no way to configure it with CSP header or another trick? I prefer not to use flash as old technology.

popler avatar May 01 '16 08:05 popler

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 16 '18 08:06 stale[bot]

Use Proxy to load HTTP video source https://github.com/netnr/proxy

You can add "https://netnr-proxy.cloudno.de/" before your video URL. e.g. https://netnr-proxy.cloudno.de/<YOUR_VIDEO_URL> if your video URL is "http://www.yourvideourl.com/stream.m3u8" https://netnr-proxy.cloudno.de/http://www.yourvideourl.com/stream.m3u8

iHad169 avatar Feb 19 '20 08:02 iHad169