[RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Destination: DefaultHTTP"]
By default the Flash Player allows your site to retrieve data from your domain only. However, when developing with Flash tools, you’ll notice that you can point to and pull in data from anywhere. This is because the Flash software grants you special permission for testing purposes. When you put your site on a server “localhost” or “www.anydomain.com”, the Flash Player places a security sandbox around it and displays this error when you reach outside of it.
So for example if your Flash site is uploaded to www.flexcapacitor.com and it makes a call to www.google.com/maps.php then an error is thrown because www.flexcapacitor.com and www.google.com are two different domains. If maps.php was on www.flexcapacitor.com in the same directory as your Flash site then because both resources are on the same domain, you are allowed access to the resources there.
<!-- SWF is on http://www.server2.com. Correct - Look at url. --> < mx:HTTPService url="http://www.server2.com/page.php" /> <!-- SWF is on http://www.server2.com. INCORRECT. Look at url. --> < mx:HTTPService url="http://www.google.com/page.php" />
Note: The following URL’s, “http://www.flexcapacitor.com” and “http://flexcapacitor.com” are two different domains according to the Flash Player. This includes subdomains. You may want to redirect calls from, “yourdomain.com” to “www.yourdomain.com” or vice versa. Your domain may have an option like this:
How do you like the www in your URL?
- Both http://www.domain.com/ and http://domain.com/ work.
- Add “www.” if somebody goes to http://domain.com/
- Remove “www.” if somebody goes to http://www.domain.com/
• Add a cross domain policy file on the domain you are calling. Your swf can access resources on other domains if the other domain grants your permission. They do this through a cross-domain file. This is a simple xml file on the other domain (yes, they have to set it up) that says what domains can access what content. Some sites already have cross-domain policy files setup. Here is an example. More info here…
• Using a proxy page. You place the proxy page on your site and then you call it. It then gets the remote sites page and passes that back to your page on your server. There are numerous examples online. Here is one…
• Grant the swf permission to access remote sites via the Flash Player Global Security Settings. You can change the security sandbox setting on a file or folder manually. This is useful if you are testing a SWF locally and want to grant it permission to pull data from a remote domain. To do this, open the SWF in the browser. Right click on the SWF and choose settings. In the Security tab (default) choose Advanced. This will take you to a site that displays the Flash Player’s settings. On the left column choose Global Settings and then add the file or folder of the swf you are testing. Typically this will be something like, “c:/projects/flex/bin-debug/”, “users/judah/documents/flex/bin-debug/” or “http://localhost/”. From now on your swf can access data on sites it’s not hosted on but remember this solution only grants that specific directory or file on your computer access to remote sites. This change doesn’t affect anyone other computer than your own. You will still need to employ another solution listed here.
• Set checkPolicyFile to false (for images). More info here, http://livedocs.adobe.com/flex/3/html/help.html?content=05B_Security_03.html and http://livedocs.adobe.com/flex/3/html/05B_Security_03.html#140657.
More info can be found here: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14213&sliceId=1
Please reply in the comments below if this helped you or not. You can also use the Error Lookup Tool to look up Flex compiler or runtime errors.