I have a Flex application running on several domains (HTTP). The application communicates with the server using, among other things, WSDL service that resides on HTTPS.
For reasons unknown (to me), sometimes I see a log entry that tells me something like this:
[FaultEvent fault=[RPC Fault faultString="Sikkerhetsfeil ved tilgang til URL-adresse" faultCode="Channel.Security.Error" faultDetail="Mål: DefaultHTTP"] messageId="D2B72EF4-65FD-4A36-6117-D4DC95E63E01" type="fault" bubbles=false cancelable=true eventPhase=2]
I managed to deduce from looking this error up on that it has something to do with SOAP calls.
I tried applying some extra entries to the crossdomain.xml based on this info, but it didn't really help.
The current content of the crossdomain.xml is as follows:
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
</cross-domain-policy>
The most maddening thing is that this error only occurs very sporadically, and is not consistent in any immediately recognizable way.
Anyone? A clue as to why could this be happening?
Related
I'm working in a company which creates a huge strategy game with ActionScript3.
I'm one of the developers here and have some issues with Socket Connections.
Socket works perfect when I use it in internal flash player or in firefox debug, it shows socket error #2048 when I'm trying to open the project with Google Chrome.
Here is the code which I use at first before trying to make a Socket Connection.
Security.allowDomain("*");
Security.allowInsecureDomain("*");
Security.loadPolicyFile("mydomain.com/crossdomain.xml");
And here is the content of crossdomain.xml file.
<cross-domain-policy>
<cross-domain-policy>
<allow-access-from domain="*"/>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*" to-ports="100-60000" secure="false"/>
</cross-domain-policy>
Then the connect function works to make a Socket Connection with server.
instance.host = host;
instance.port = port;
socket = new Socket(host, port); //Initializing the socket
Is there any problems with Server or the problem caused by Chrome?
If you had the same issue and found something useful please answer to this question.
I'm searching a solution for a few days, but nothing works.
If you are trying to launch this swf file from localhost, which is the usual case when debugging, you can add your swf's path to flash player's trusted locations.
This procedure is written here.
Also try with this simpler cross domain file.
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>
I am attempting to use TCP Socket from Flash ActionScript. I am using a standard example provided by Adobe. Here is the code:
// Load policy file from remote server.
Security.loadPolicyFile("http://" + serverURL + "/crossdomain.xml");
// Attempt to connect to remote socket server.
try {
msg("Trying to connect to " + serverURL + ":" + portNumber + "\n");
socket.connect(serverURL, portNumber);
} catch (error:Error) {
/*
Unable to connect to remote server, display error
message and close connection.
*/
msg(error.message + "\n");
socket.close();
}
My crossdomain.xml file located on port 80:
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd">
<allow-access-from domain="*" to-ports="*"/>
</cross-domain-policy>
When I load application, I see in my inspector that it accesses the policy file successfully. However Event.CONNECT is never called. I have tried opening various different ports on various domains including same domain with no luck. Tried different policy files.
What am I missing?
If the allowscriptaccess is false you won't be able to bypass that so what you are missing is the adobe policy server.
http://vvowproject.googlecode.com/svn-history/r41/trunk/server/flashpolicyd.py
On the server open port 843 then use this command
sudo ./flashpolicyd.py --file=crossdomain.xml --port=843
here is the crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="SOAPAction"/>
</cross-domain-policy>
This will definitely work, i tried it myself with your example.
This is what I know from using TCP/IP Sockets and XML. I've set up a Ruby server with a Flash client successfully, but want to know more about chat servers. I hope some of this is helpful.
You need a Daemon with Flash AS3. Here's the documentation.
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000318.html
alt text http://www.ashcraftband.com/myspace/videodnd/daemonLil.jpg
To create a socket connection, you must create a server-side application to wait for the socket connection request and send a response to the SWF file. This type of server-side application can be written in a programming language such as Java, Python, or Perl. To use the XMLSocket class, the server computer must run a daemon that understands the protocol used by the XMLSocket class. The protocol is described in the following list:
• XML messages are sent over a full-duplex TCP/IP stream socket connection.
• Each XML message is a complete XML document, terminated by a zero (0) byte.
• An unlimited number of XML messages can be sent and received over a single XMLSocket connection.
Understanding the security changes in Flash Player 10
http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes_02.html
XML SECURITY POLICY
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="SOAPAction"/>
</cross-domain-policy>
FLASH CLIENT
Remember to set Publish Settings to Access Network Only.
SERVER
Open a separate port for security policy, and keep it running in the background.
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?
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;
}
}
Before I start I should state I have read it all, I was following this, this and this (and more...) and still I cannot connect to our running server via Socket over the internet.
Here is what I try to in AS3:
var host :String = "192.168.2.11";
Security.allowDomain(host);
Security.allowInsecureDomain(host);
Security.loadPolicyFile("xmlsocket://" + host + ":" + "843");
// TTS server socket
_socket = new Socket();
_socket.addEventListener(Event.CLOSE, handleClose);
_socket.addEventListener(IOErrorEvent.IO_ERROR, handleError);
_socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleSecError);
_socket.addEventListener(ProgressEvent.SOCKET_DATA, handleIncomingData);
_socket.addEventListener(Event.CONNECT, handleConnect);
_socket.connect(host, 1337);
As you can see, the host is a local address, but that shouldn't matter as long as I am in this local network. And I am, since this does work from my IDE (FD4).
Also, the swf is on the same server as the application it tries to connect to, but on another port.
The policy file the server sends (we have tried both from port 843 and 1337) is the following:
<?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="*" to-ports="*" />
</cross-domain-policy>
We can see from the log output of the server that this is really sent to the connecting socket. A null byte is of course sent after the xml data. And after that, the server closes the connection. However, it seems that Flash somehow does not like it, as "Error #2048" still appears after ~3 seconds.
We're really out of ideas here...
We managed to get it to work by including another tag:
<site-control permitted-cross-domain-policies="master-only"/>
It seems that this tag is necessary in order to get it to work. We could not get it to work without that tag, no matter which port we tried.
So the complete xml now looks like this in our case (it is of course easy to modify to fit any case):
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*" to-ports="*"/>
</cross-domain-policy>
It really is a shame that this line is not included in Adobe's own example (!!). I mean, it IS included in the example files, but not in the article. I don't want to know how many people were stuck at this stage because of that...
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation:
I don't get this error on my local host but I do when I upload it to my server. How
do I properly fix this in Flash CS4?
Check where you are pointing to for any external assets or data. More than likely you need a crossdomain.xml file that will say that it is okay for your server to access the data. To be clear, you need the crossdomain file where the assets are that you are pulling.
More information here: http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html
An example of a wide open crossdomain.xml file:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
You can specify a domain where the * is and list multiple allow-access-from nodes. You can also specify all subdomains on a domain by saying *.mydomain.com
To be clear, you do not want to go to production with the wide open example I have given, but it is something you can use to test out and make sure this is your problem. Once you verify this then you can restrict it to the appropriate levels.
Basically though you just create a file called crossdomain.xml and put this xml in it.
Make sure it is placed at the root of the server that the data or assets are being pulled from.