ssl - SWF(使用 URLLoader)可以访问 HTTPS 网络服务吗?

标签 ssl https flash urlrequest

我有一个 fla(使用 ActionScript 3.0),我正在 Flash 中编译。我正在使用 URLRequest 和 URLLoader 来访问 http 网络服务。

var loader:URLLoader = new URLLoader();     
var request:URLRequest = new URLRequest("http:test.webservice.com");    
try {
   loader.load(request);
} catch (error:Error) {
   trace("Unable to load requested document.");
}

这工作正常 - 但是如果我尝试访问我得到的 https 地址

httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0]
ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://test.webservice.com"]

如何从 https 网络服务检索数据? SWF 是否必须托管在受 SSL 保护的页面上?

最佳答案

如果您安装了 flash 调试播放器,您可能会在日志中看到以下内容:

** Security Sandbox Violation ***
Connection to https://www.example.com/service/ halted - not permitted from http://www.example.com/your.swf

Error: Request for resource at https://www.example.com/service/ by requestor from http://www.example.com/your.swf is denied due to lack of policy file permissions.

默认情况下,托管在 http 中的 swf 无法访问 https -- 它被视为不同的域。

您需要设置适当的 crossdomain.xml 策略文件,并注意验证 Content-Type 是 text/* 还是其他列入白名单的值。此外,您需要一个带有“secure=false”的元策略文件,这将允许从 http 访问 https。

  <allow-access-from domain="www.example.com" secure="false" />

进一步阅读:

Policy file changes in Flash Player 9 and Flash Player 10

关于ssl - SWF(使用 URLLoader)可以访问 HTTPS 网络服务吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1387608/

相关文章:

php - 通过 PHP 发送推送通知

iis - 在 IIS8 上设置 SSL

wordpress - HTTPS 的不安全内容 - wordpress

rss - 通过 HTTPS 加载 feedburner RSS 提要

actionscript-3 - 用于处理 Apple HTTP Live Streaming 的 AS3 库

actionscript-3 - Flash AS3使声音停止在特定帧上

delphi - Indy TIdSSLIOHandlerSocketOpenSSL - 它可以在我的电脑上运行,但不能在我 friend 的电脑上运行

java - 如何使用 java 使用属性或 VM 选项打开 SSL/TLS 验证?

ssl - 等待 *tls.certificateStatusMsg 时收到类型为 *tls.serverKeyExchangeMsg 的意外握手消息

javascript - 减少 sifr 渲染时间