合肥光源的Chromecast的支持,在Amazon S3 CORS错误 [英] Chromecast support for HLS, CORS error on Amazon S3
问题描述
我试图整合HLS在我的Chromecast应用流。
该接收器部分是很好,因为我检查与多个HLS流网址。
我只是不能让CORS位正常运行。
我使用亚马逊的AWS S3。我已经设置了CORS我斗。
< XML版本=1.0编码=UTF-8&GT?;
< CORSConfiguration的xmlns =http://s3.amazonaws.com/doc/2006-03-01/>
< CORSRule>
< AllowedOrigin> *< / AllowedOrigin>
< AllowedMethod> GET< / AllowedMethod>
< AllowedMethod> PUT< / AllowedMethod>
< AllowedMethod> POST< / AllowedMethod>
< AllowedMethod>删除< / AllowedMethod>
< AllowedHeader> *< / AllowedHeader>
< / CORSRule>
< / CORSConfiguration>
在我的假设,这应该允许从所有域访问访问此桶内的资源。
不过还是我来自的Chromecast获得在javascript下面的错误。
XMLHtt prequest无法加载http://s3-eu-west-1.amazonaws.com/interactive-encoding-out/watermark-sintel-test/playlist.m3u8 。没有访问控制 - 允许 - 原产地标头的请求的资源present。原产地https://s3-eu-west-1.amazonaws.com,因此不允许访问。
解决方案
现在,我已经使用corsproxy作为一个反向代理服务器,增加了CORS的头我的要求
运行CORS代理:
$ corsproxy< SERVER_IP> < DESIRED_PORT>
和运行类似的要求:
的http://< SERVER_IP>:< DESIRED_PORT> /<您的请求>
从
安装: https://www.npmjs.org/package/corsproxy
I am trying to integrate HLS streams in my chromecast app.
The receiver part is fine because i checked it with multiple HLS Stream urls.
i just cant get the CORS bit to operate correctly.
I am using Amazon AWS S3. I have set the CORS for my bucket.
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
in my assumption this should allow access from all domains to access the resources inside this bucket.
But still i am getting the following error in javascript from Chromecast.
XMLHttpRequest cannot load http://s3-eu-west-1.amazonaws.com/interactive-encoding-out/watermark-sintel-test/playlist.m3u8. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s3-eu-west-1.amazonaws.com' is therefore not allowed access.
Right now i have used corsproxy as a reversed proxy that adds cors headers to my request. Really recommand this solution. No need for a custom receiver app this way. just install the corsproxy somewhere on your server
run the cors proxy:
$ corsproxy <SERVER_IP> <DESIRED_PORT>
and run the request like :
http://<SERVER_IP>:<DESIRED_PORT>/<YOUR REQUEST>
install from: https://www.npmjs.org/package/corsproxy
这篇关于合肥光源的Chromecast的支持,在Amazon S3 CORS错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!