2010-03-30 43 views
0

我試圖將Flex應用程序與Google Checkout相集成,並且在我的本地計算機上運行正常的代碼在我的網站上測試時會拋出安全錯誤。Flex:嘗試訪問Google Checkout的安全性錯誤

這裏的錯誤:

Warning: Failed to load policy file from https://sandbox.google.com/crossdomain.xml 

*** Security Sandbox Violation *** 
Connection to https://sandbox.google.com/checkout/api/checkout/v2/request/Merchant/12345 halted - not permitted from http://www.mysite.com/demo/cartTest/main.swf 
ERROR (flash.events::SecurityErrorEvent)#0 
    bubbles = false 
    cancelable = false 
    currentTarget = (flash.net::URLLoader)#1 
    bytesLoaded = 0 
    bytesTotal = 0 
    data = (null) 
    dataFormat = "text" 
    eventPhase = 2 
    target = (flash.net::URLLoader)#1 
    text = "Error #2170: Security sandbox violation: http://www.mysite.com/demo/cartTest/main.swf cannot send HTTP headers to https://sandbox.google.com/checkout/api/checkout/v2/request/Merchant/12345." 
    type = "securityError" 
Error: Request for resource at https://sandbox.google.com/checkout/api/checkout/v2/request/Merchant/12345 by requestor from http://www.mysite.com/demo/cartTest/main.swf is denied due to lack of policy file permissions. 

就像我說的,它運行良好本地。我怎樣才能解決這個安全錯誤?

+0

我想我可能在我的flex應用程序中組裝google購物車,然後傳遞給頁面的.js以將數據發送到Google。 – DrANoel 2010-03-30 20:03:42

回答

1

要解決這個問題之一,我組裝的Flex HTML表單,然後傳遞出到頁面上的JS,如果它附加到一個空的表單頁面上,然後提交表格。我將表單隱藏起來,以便所有UI輸入和操作都發生在swf中。我不喜歡它,但我會忍受它。

0

您正在從http:加載swf並嘗試訪問https: URL。 默認情況下,這將被阻止(錯誤#2170)。

要使其工作在目標域(您試圖從Flash訪問的域)應該有一個允許不安全訪問的/crossdomain.xml(secure =「false」)。下面crossdomain.xml會在你的情況下工作過,如果只有你可以把你的目標 URL的根訪問,即https://sandbox.google.com/crossdomain.xml

<?xml version="1.0"?> 
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> 
<cross-domain-policy> 
    <site-control permitted-cross-domain-policies="master-only"/> 
    <allow-access-from domain="*" secure="false"/> 
    <allow-http-request-headers-from domain="*" headers="*" secure="false"/> 
</cross-domain-policy> 

更多關於安全標誌的位置:http://www.adobe.com/devnet/..../fplayer9_security.html#_Secure_Domain_Lists

相關問題