amazon-s3corsbunnycdn

Unable To Configure BunnyCDN with AWS S3 For HLS Streaming


I have successfully configured S3 bucket with BunnyCDN and able to access files through it. Now I am facing the issue when I try to stream HSL encrypted video with BunnyCDN which stored in S3 bucket.

In the browser console I am getting issue like this:

Access to XMLHttpRequest at 'https://ovb-video.b-cdn.net/bcdn_token=hT1XzEdqq1xj5TGhEgM8JP1WsTeHzvfxmqfL3g3-_RE&expires=1632877673&token_path=%2F/books/11/2/video.m3u8' from origin 'https://my-domain.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

As we have to specify allow origins when request's credentials mode is true so I have specifies CORS policy at S3 like this:

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "POST",
            "GET",
            "PUT",
            "HEAD"
        ],
        "AllowedOrigins": [
            "https://my-domain.com",
            "https://ovb-video.b-cdn.net"
        ],
        "ExposeHeaders": []
    }
]

In BunnyCDN panel I have also specified m3u8, ts, key in headers but still no luck.

Can anybody please let me know what I am doing wrong.


Solution

  • You have to add 3 edge rules for that particular pull zone so that it can serve data with S3. Please find screenshots of 3 edge rules.

    enter image description here enter image description here enter image description here