How to securely play .m3u8 streaming file from AWS S3 using CloudFront?

Question:

I’m using CloudFront Signed URL to display images and videos from S3 to be secured.

It works well on images and other videos except for .m3u8 file.

I used AWS PHP SDK and here’s my code.

If I’m not mistaken, it doesn’t play because we need also to sign the segmented files (.ts) inside the .m3u8 file.

How can we dynamically change it?

Is there any way we can play .m3u8 file securely so that users can’t use the direct link access to download the file?

Answer:

CloudFront signed URLs work great when it is just one file, but like you have discovered it is a problem when you have multiple resources.

For this reason the recommended approach is to use signed CloudFront cookies.

By doing this you only need to sign once to allow all resources from a specific CloudFront distribution and do not need to bother with the signing process on each page load.

Leave a Reply