Search This Blog

Friday, March 11, 2011

Flex/Flashbuilder Security error accessing url; crossdomain.xml

There’re new security rules applied in Flash Builder 4. Everything works fine when you debug your application from localhost. However if you try to access your page from remote host you’ll come across an error: “Security error accessing url”. To resolve the situation you’ll have to create a file named: crossdomain.xml at the root of your domain. Sample crossdomain.xml can be found here.

That’s not all. If you want to access the site from remote hosts, just export the project from FlashBuilder! (Project->Export release build). In debug releases Flash forces browser to download crossdomain.xml from “localhost”. In release builds crossdomain.xml will be downloaded from the server.

 

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

5 comments:

  1. does this universal access (*) cause security vulnerabilities?

    ReplyDelete
  2. I was really wondering the same thing. My application is available in local network only so the matter of vulnerability does not concern me and I had to add cross-domain-policy file in order to start serving the application at all.
    More info on cross-policy is available here:

    http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html

    ReplyDelete
  3. Everyone tells the same things about this security error and crossdomain.xml. But in addition to this you said :

    ......That’s not all. If you want to access the site from remote hosts, just export the project from FlashBuilder! (Project->Export release build). In debug releases Flash forces browser to download crossdomain.xml from “localhost”. In release builds crossdomain.xml will be downloaded from the server........

    That's why you are genius and saved my project. I m really grateful i wish you the best. Thanks man.

    ReplyDelete
  4. hopefully not too dumb a question - which is the root folder of my domain?
    Is it where my index.html file sits?

    ReplyDelete

If you like this post, please leave a comment :)