简体   繁体   English

通过flex进行安全的Web套接字连接会产生安全沙箱冲突

[英]secure web socket connection through flex generates a Security sandbox violation

I'm trying to connect to a secure web socket (wss://) using flex, and i'm getting a Security sandbox viloation error. 我正在尝试使用flex连接到安全的Web套接字(wss://),并且遇到了“安全”沙箱冲突错误。

the full error message is the following: 完整的错误消息如下:

*** 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."]

Connection Failure: Error #2048: Security sandbox violation: https://foo.bar.com:8443/foo/bar-html/Main.swf cannot load data from foo.bar.com:8443. 连接失败:错误#2048:违反安全沙箱: https ://foo.bar.com:8443/foo/bar-html/Main.swf无法从foo.bar.com:8443加载数据。 Websocket closed. Websocket已关闭。

The browser that i'm trying to use is FireFox 20.0.1. 我要使用的浏览器是FireFox 20.0.1。

I created a javascript client that connects to that same address using wss:// protocol on port 8443 and it connected just fine. 我创建了一个JavaScript客户端,该客户端在端口8443上使用wss://协议连接到该地址,并且连接正常。

I included a crossdomain.xml file in under ROOT directory of my tomcat so the flex application will be able to load it. 我在tomcat的ROOT目录下包含一个crossdomain.xml文件,因此flex应用程序将能够加载它。 the content of the crossdomain.xml file is as follows: 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>

I checked with firebug and noticed that the crossdomain.xml file was loaded properly. 我检查了萤火虫,发现crossdomain.xml文件已正确加载。

I tried to specify manually the location of the crossdomain.xml file using 我尝试使用以下命令手动指定crossdomain.xml文件的位置

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

but I got the same results. 但我得到了相同的结果。

i also tried different configuration variations in this crossdomain.xml. 我还在此crossdomain.xml中尝试了不同的配置变化。 for example secure="yes" , i tried to specify the ports used, but nothing worked, i always got the security sandbox violation. 例如secure="yes" ,我试图指定使用的端口,但没有任何效果,我总是遇到安全沙箱冲突。

I know that mms.cfg file may have DisableSockets = 1 directive turned on but I do not have such a file in my system. 我知道mms.cfg文件可能启用了DisableSockets = 1指令,但是我的系统中没有这样的文件。 I'm on a Linux Gentoo. 我正在使用Linux Gentoo。

the funny thing is that my system is on the same domain and the same port that my websockets are! 有趣的是,我的系统与websocket位于同一域和同一端口上!

it's actually a facebook application that sit's on apps.facebook.com/foo for example.. and that canvas page is for example foo.bar.com:8443 它实际上是一个Facebook应用程序,例如位于apps.facebook.com/foo上。而该画布页面例如是foo.bar.com:8443

and then the secure web socket address is also wss://foo.bar.com:8443! 然后安全的Web套接字地址也是wss://foo.bar.com:8443! so i don't really understand why I need to deal with cross domain in the first place! 所以我真的不明白为什么我首先需要处理跨域!

any information regarding the issue would be greatly appreciated! 任何有关此问题的信息将不胜感激!

thank you 谢谢

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

It opens a server on port 843 that actually servers a poilcy file per request. 它在端口843上打开一个服务器,该服务器实际上为每个请求提供文件库。 you have a policy file there that accepts every host and every port, you need to modify it according to your needs. 您在其中有一个接受每个主机和每个端口的策略文件,您需要根据需要对其进行修改。

then you need in the flex code to point the policy file to that address using xmlsocket:// protocol. 那么您需要在flex代码中使用xmlsocket://协议将策略文件指向该地址。

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

that's it! 而已!

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

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