2

我在 Python Gae sdk 中创建了一个 flex 应用程序,但出现错误 2048,所以我在静态文件夹下放置了一个 crossdomain.xml。crossdomain.xml 如下:

<?xml version="1.0"?> 
<!DOCTYPE cross-domain-policy SYSTEM “/xml/dtds/cross-domain-policy.dtd”&gt;
<cross-domain-policy> 
<site-control permitted-cross-domain-policies="all"/> 
<allow-access-from domain="*" to-ports="*" secure="false"/> 
<allow-http-request-headers-from domain="*" headers="*" secure="false"/> 
</cross-domain-policy> 

而且,我在 app.yaml 中添加了以下内容:

- url: /crossdomain.xml 
  static_files: static/crossdomain.xml 
  upload: static/crossdomain.xml

但是,我仍然收到错误 2048。因此,我想知道在我的情况下我需要配置或遗漏什么以及如何修复该错误。

请指教。谢谢。

4

2 回答 2

4

我没有在 Flash 中使用过 crossdomain.xml,但在 Unity3d 中使用过。我已经让它工作了,你所拥有的看起来是正确的。

您是否访问过 yoursite.com/crossdomain.xml 以确保它在浏览器中可见?

如果 Flash 真的很挑剔,你可能需要指定一个 mimetype(text/xml 或 application/xml)

- url: /crossdomain.xml 
  mime_type: text/xml
  static_files: static/crossdomain.xml 
  upload: static/crossdomain.xml

您可能还想在验证器中检查您的 crossdomain.xml,以确保您没有丢失 /> 或类似的东西。

另外,请查看html5boilerplate 的 crossdomain.xml。他们的限制最少的版本应该适用于任何网站:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>


<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->

<!-- Most restrictive policy: -->
<!--
    <site-control permitted-cross-domain-policies="none"/>
-->


<!-- Least restrictive policy: -->
    <site-control permitted-cross-domain-policies="all"/>
    <allow-access-from domain="*" to-ports="*" secure="false"/>
    <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
<!--
  If you host a crossdomain.xml file with allow-access-from domain=“*”      
  and don’t understand all of the points described here, you probably       
  have a nasty security vulnerability. ~ simon willison
-->

</cross-domain-policy>
于 2011-02-15T01:30:55.133 回答
1

FlashPlayer 正在crossdomain.xmlURL 域根目录中查找文件,例如

domain.com/crossdomain.xml

是 FlashPlayer 想要找到它的地方。

但是,您可以使用从服务器上的备用位置Security.loadPolicyFile(url)加载文件。crossdomain.xml

有关 Adob​​e livedocs 的更多信息

于 2011-02-15T00:51:23.960 回答