简体   繁体   English

针对Azure Blob存储使用套接字的CORS

[英]CORS using sockets against Azure Blob Storage

I've worked around this but it's an interesting issue. 我已经解决了这个问题,但这是一个有趣的问题。

So using Unity and Unity Web Player (I know WebGL blah blah but it isn't baked yet and doesn't support everything we need) we are streaming video directly from Azure Blob storage. 因此,使用Unity和Unity Web Player(我知道是WebGL等等,但尚未发布,并且不支持我们所需的一切),我们直接从Azure Blob存储中流式传输视频。

Now the built in class WWW is a non-starter since it doesn't stream and some of these vids are fairly large. 现在,内置类WWW是非入门类,因为它不会流式播放,并且某些vid相当大。 So we used a plugin and a class MovieStreamer to stream the vids. 因此,我们使用了一个插件和一个类MovieStreamer来播放视频。 The plugin uses sockets directly but through Unity's version of mono. 该插件直接使用套接字,但通过Unity的mono版本使用套接字。 The sockets require a cross domain policy be available on the flash port for CORS (873 using a non-http protocol). 套接字要求在Flash端口上为CORS(使用非HTTP协议的873)提供跨域策略。

I had thought that setting the CORS policy on the storage server would enable this. 我以为在存储服务器上设置CORS策略将启用此功能。 Since the HTTP(s) CORS policy can be set by placing a crossdomain.xml in the $root and making it publicly accessible the CORS policy through API seems redundant. 由于可以通过在$ root中放置crossdomain.xml并使其可公开访问来设置HTTP CORS策略,因此通过API进行CORS策略似乎是多余的。 However, it just doesn't work. 但是,它根本不起作用。 Even with all "*"s I see the same error for a missing cross domain policy even with the http crossdomain file and settings through the API. 即使使用所有“ *”,即使使用HTTP跨域文件通过API进行的设置,我也会因缺少跨域策略而看到相同的错误。

What I did was hack things to use another streaming HTTP plugin and like magic that works since it does in fact use the crossdomain.xml. 我所做的是破解东西以使用另一个流HTTP插件,并且像魔术一样起作用,因为它实际上使用了crossdomain.xml。 So without settings changed in AZURE socket CORS is a no go but BestHTTP works fine as does WWW. 因此,无需更改AZURE套接字中的设置,CORS是无法实现的,但BestHTTP可以像WWW一样正常工作。

So the questions are: What support does Azure storage have for CORS. 因此问题是:Azure存储对CORS有哪些支持。 Is the policy API supposed to enable the flash route? 策略API是否应该启用Flash路由? What is the precedence between the two flows? 两种流程之间的优先顺序是什么?

Keep in mind we aren't using flash it's just that the socket route piggy backs on the flash protocol. 请记住,我们不使用闪存,只是套接字路由背负了闪存协议。

代码示例可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM