簡體   English   中英

通過flex進行安全的Web套接字連接會產生安全沙箱沖突

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

我正在嘗試使用flex連接到安全的Web套接字(wss://),並且遇到了“安全”沙箱沖突錯誤。

完整的錯誤消息如下:

*** 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>

我檢查了螢火蟲,發現crossdomain.xml文件已正確加載。

我嘗試使用以下命令手動指定crossdomain.xml文件的位置

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

但我得到了相同的結果。

我還在此crossdomain.xml中嘗試了不同的配置變化。 例如secure="yes" ,我試圖指定使用的端口,但沒有任何效果,我總是遇到安全沙箱沖突。

我知道mms.cfg文件可能啟用了DisableSockets = 1指令,但是我的系統中沒有這樣的文件。 我正在使用Linux Gentoo。

有趣的是,我的系統與websocket位於同一域和同一端口上!

它實際上是一個Facebook應用程序,例如位於apps.facebook.com/foo上。而該畫布頁面例如是foo.bar.com:8443

然后安全的Web套接字地址也是wss://foo.bar.com:8443! 所以我真的不明白為什么我首先需要處理跨域!

任何有關此問題的信息將不勝感激!

謝謝

我安裝了http://code.google.com/p/flashpolicyd/

它在端口843上打開一個服務器,該服務器實際上為每個請求提供文件庫。 您在其中有一個接受每個主機和每個端口的策略文件,您需要根據需要對其進行修改。

那么您需要在flex代碼中使用xmlsocket://協議將策略文件指向該地址。

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

而已!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM