我正在使用ZendAMF協議開發一個帶有Flex和PHP的Web應用程序。從昨天開始,每當我將應用程序發佈到遠程服務器時,都會出現這個奇怪的問題。 本地一切工作正常,只有當我發佈它在服務器上。這裏是我的ErrorMessage得到:Flex版本構建安全沙箱違例錯誤#2048
Send failed
Channel.Security.Error error Error #2048: Security sandbox violation: http://mydomain.com/login/MainFrame.swf cannot load data from http://localhost/bin-debug/gateway.php. url: 'http://localhost/bin-debug/gateway.php'
我敢肯定沒有錯我gateway.php和amf_config文件,因爲我知道他們是略有不同。 (我正在使用這些文件從一個備份的地方工作)
進一步,我複製我的crossdomain.xml也在Web根目錄和它自動進入的應用程序目錄。這是內容:
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
問題是,在生產發佈它仍然試圖訪問本地文件。我已經嘗試了很多關於這個問題的搜索,但沒有發現與我的情況相同。
gateway.php源部分
<?php
ini_set("display_errors", 1);
$dir = dirname(__FILE__);
$webroot = $_SERVER['DOCUMENT_ROOT'];
$configfile = "$dir/amf_config.ini";
//default zend install directory
$zenddir = $webroot. '/ZendFramework/library';
//Load ini file and locate zend directory
if(file_exists($configfile)) {
$arr=parse_ini_file($configfile,true);
if(isset($arr['zend']['webroot'])){
$webroot = $arr['zend']['webroot'];
$zenddir = $webroot. '/ZendFramework/library';
}
if(isset($arr['zend']['zend_path'])){
$zenddir = $arr['zend']['zend_path'];
}
}
我能解決這個問題下一個試試?
我想你明白是什麼錯誤 - 在遠程服務器正試圖訪問本地主機;這可能不會起作用。你是否在你的代碼中硬編碼localhost引用?或者它在配置文件中?沒有代碼審查,我認爲我們不能提供更多幫助。 – JeffryHouser
沒有沒有在項目設置旁邊的應用程序中使用的合併網址 - > Flex服務器,其中我的webroot設置爲/ Applications/MAMP/htdocs和根URL爲http:// localhost/ – dotNes
我不確定Flash Builder的Flex服務器設置是做什麼的。不過,我不希望它改變你的代碼。你正在編譯一個服務配置到你的主文件中嗎?許多AMF實現使用外部配置文件方法。我會在那裏尋找一個硬編碼的「本地主機」參考。您也可以查看您引用的任何外部庫。 – JeffryHouser