Search code examples
actionscript-3flashapache-flexflash-builder

Socket: Security sandbox violation


I'm trying to open a socket to my server, but it doesn't work, I'm always getting the famous

Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: http://zappy.mydomain.fr/ZappyGraphic.swf cannot load data from zappy.mydomain.fr:4242.

I have a crossdomain.xml at the root of my domain, looking like that:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
    <allow-access-from domain="*" secure="false" />
    <site-control permitted-cross-domain-policies="master-only"/>
    <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

And in my actionscript program, here is how I load the crossdomain policies

Security.allowDomain("*");
Security.allowInsecureDomain("*");
Security.loadPolicyFile("http://mydomain.fr/crossdomain.xml");

The server is located at mydomain.fr on the port 4242 and the swf file is located at http://zappy.mydomain.fr/index.html...

Can someone enlighten me?


Solution

  • It seems like you can not have a space at the end of the line, so:

    <allow-access-from domain="*" secure="false" />
    

    Has to be

    <allow-acces-from domain="*" secure="false"/>
    

    Thanks to make me lose my time ! :D

    And, as @Gio made me notice, you have to configure a socket policy server listening on port 843. Here is my nginx configuration if someone needs it:

    server {
        listen 843;
        server_name mydomain.fr;
        location / {
            rewrite ^(.*)$ /crossdomain.xml;
        }
    
        error_page 400 /crossdomain.xml;
    
        location = /crossdomain.xml {
            root /usr/share/nginx/www/root;
        }
    }