2013-07-11 77 views
0

我试图使用flex连接到安全的web套接字(wss://),并且出现Security sandbox viloation错误。通过flex安全web套接字连接生成安全沙箱违规

完整的错误消息如下:

*** Security Sandbox Violation *** 
Connection to foo.bar:8443 halted - not permitted from https://foo.bar:8443/foo/foo-html/Main.swf 
Security Error: [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048: Security sandbox violation: https://foo.bar.com:8443/foo/foo-html/Main.swf cannot load data from come2play.xpogames.com:8443."] 

连接失败:错误#2048:安全沙箱冲突:https://foo.bar.com:8443/foo/bar-html/Main.swf无法从foo.bar.com:8443加载数据。Websocket关闭。

我试图使用的浏览器是FireFox 20.0.1。

我创建了一个JavaScript客户端,使用端口8443上的wss://协议连接到相同的地址,它连接的很好。

我在tomcat的ROOT目录下包含了一个crossdomain.xml文件,所以flex应用程序将能够加载它。 crossdomain.xml文件的内容如下:

<?xml version="1.0"?> 
<cross-domain-policy> 
    <allow-access-from domain="*" secure="false" /> 
     <allow-http-request-headers-from domain="*" headers="*"/> 
</cross-domain-policy> 

我用firebug检查并注意到crossdomain.xml文件已正确加载。

我尝试使用

flash.system.Security.loadPolicyFile("{Url to my crossdomain.xml file on the SSL virtual root}"); 

手动指定crossdomain.xml文件的位置,但我得到了相同的结果。

我也在这个crossdomain.xml中尝试了不同的配置变体。例如secure="yes",我试图指定使用的端口,但没有任何工作,我总是违反安全沙箱。

我知道mms.cfg文件可能会打开DisableSockets = 1指令,但我的系统中没有这样的文件。我在Linux Gentoo上。

有趣的是,我的系统与我的websockets在同一个域和端口上!

它实际上是坐对apps.facebook.com/foo例如.. 和画布页一个Facebook应用程序,例如foo.bar.com:8443

,然后安全网络套接字地址是也wss://foo.bar.com:8443!所以我不明白为什么我需要首先处理跨域问题!

有关该问题的任何信息将不胜感激!

谢谢

+1

请问这个问题的答案有帮助吗? http://stackoverflow.com/questions/2181320/help-with-cross-domain-file-for-actionscript-3-socket – JeffryHouser

+0

我试图将策略文件指向xmlsocket:// myserver:8443,但它不甚至去那里 – ufk

+0

什么不去哪里? – JeffryHouser

回答

0

我安装http://code.google.com/p/flashpolicyd/

它打开端口843的服务器,实际上每个服务器请求的poilcy文件。 你有一个策略文件可以接受每个主机和每个端口,你需要根据你的需要进行修改。

然后您需要在flex代码中使用xmlsocket:// protocol将策略文件指向该地址。

Security.loadPolicyFile("xmlsocket://hostname:843"); 

就是这样!