« Flex Examples
» How to find the class name of an object instance?

Flex resources, Made in Flex, Security

Cross domain policy

Andrei Ionescu | 17.10.07 | Comment?

Some times you may pass over the following problem: the data doesn’t loads although the flex application is showing busy cursor. It remains in the loading process but it doesn’t finish. One of the following thing happens:

Cross domain policy - access denied

As you can see in the image above the SWF is not accessing the same domain it come from as it resides on www.test.ro and tries to access www.testserver.ro. Due to flash player security policy this is not posible by default.

Here enters the crossdomain.xml file (the default cross-domain policy file). A cross-domain policy file is an XML file that provides a way for the server to indicate that its data and documents are available to SWF files served from other domains. Any SWF file that is served from a domain that the server’s policy file specifies is permitted to access data or assets from that server.

When a Flash document attempts to access data from another domain, Flash Player attempts to load a policy file from that domain.

crossdomain.xml resides at the root directory of the server that is serving the data. The following example policy file permits access to Flash documents that originate from foo.com, friendOfFoo.com, *.foo.com, and 105.216.0.40:

<?xml version="1.0"?>
<!-- http://www.foo.com/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="www.friendOfFoo.com"/>
<allow-access-from domain="*.foo.com"/>
<allow-access-from domain="105.216.0.40"/>
</cross-domain-policy>

You can also configure ports in the crossdomain.xml file and you can use the loadPolicyFile() method to access a nondefault policy file.

If you are in the case bellow, then no need of cross domain policy file because the SWF come from the same domain it tries to access back.

Cross domain policy - access accepted

Resources:
Using cross-domain policy files
Overview of permission controls
Cross-domain policy file usage recommendations for Flash Player
Allowing cross-domain data loading
About compatibility with previous Flash Player security models
cross domain policy files (moock.org)
Why crossdomain.xml is a good thing

Share and Enjoy:
  • Technorati
  • StumbleUpon
  • del.icio.us
  • NewsVine
  • Reddit
  • Digg
  • Furl
  • co.mments
  • blogmarks
  • Slashdot
  • description
  • Taggly
  • YahooMyWeb
  • connotea
  • Webride




Tags: , , , ,

This post was written by Andrei Ionescu

Views: 2452

related

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">

:

:


« Flex Examples
» How to find the class name of an object instance?