【问题标题】:CrossDomain Access, HLS through CloudFront with Signed URL(JWplayer)跨域访问,通过 CloudFront 使用签名 URL 进行 HLS(JWplayer)
【发布时间】:2016-10-18 20:10:51
【问题描述】:

我正在通过 Amazon S3Cloud Front 使用 HLS 流式传输,并使用 JWplayer (使用 Rails)

我使用签名 URL 对 URL 进行加密,并创建了 Amazon Cloud Front 文档中给出的原始访问身份。 签名 URL 生成良好。

我的存储桶中还有一个 'crossdomain.xml' 文件,该文件允许所有来源(我已给出“*”) 现在,当我尝试播放存储桶中的 Hls 视频文件时,我遇到了跨域访问被拒绝问题

我认为 JW Player 试图在没有签名哈希的情况下访问“crossdomain.xml”文件。所以,它得到了那个错误。

我已经在演示 JWplayer Stream 测试器中测试了我的文件,这是我在控制台中遇到的错误。

Fetch API cannot load http://xxxxxxxx.cloudfront.net/xxx/1/1m_test.ts. 

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://demo.jwplayer.com' is therefore not allowed access. The response had HTTP status code 403.

If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

这是截图。

请帮帮我。谢谢。

This is the link I followed to configure my CloudFront Distribution

【问题讨论】:

    标签: amazon-s3 jwplayer amazon-cloudfront


    【解决方案1】:

    我也遇到了同样的问题(但使用的是 Flowplayer)。我还不确定安全风险(以及是否需要所有步骤),但我可以通过以下方式运行它:

    • 在 crossdomain.xml 上添加权限供所有人打开/下载
    • 在 Cloudfront 分发中添加仅针对 crossdomain.xml 的行为,不限制访问(在 * 访问受限的行为之上)
    • 然后我注意到在存储桶中,指向 crossdomain.xml 的链接类似于“https://some-server.amazonaws.com/bucket.name/%1Fcrossdomain.xml”(注意奇怪的 %1F),当我继续重命名 crossdomain.xml 时,我可以删除名称的第一个位置有一个不可见字符(我没有创建 crossdomain.xml,所以我不确定这是怎么发生的)

    编辑: 我也让 hlsjs 与它一起运行,并使 crossdomain.xml 可访问以某种方式禁用了 CORS 请求。我还在研究这个。

    【讨论】:

    • 我可以确认这是可行的。只需要第一个和第二个项目符号。我也在 Flowplayer 中对此进行了测试。
    猜你喜欢
    • 1970-01-01
    • 2015-02-13
    • 2018-01-16
    • 2013-01-03
    • 2019-08-30
    • 2015-05-21
    • 1970-01-01
    • 2022-06-11
    • 2012-02-12
    相关资源
    最近更新 更多