- Home /
crossdomain.xml - No valid crossdomain policy available
I have crossdomain.xml in the root of my server, but I still get this error.
SecurityException: No valid crossdomain policy available to allow access
UnityEngine.WWW.get_text () (at C:/BuildAgent/work/f724c1acfee760b6/Runtime/ExportGenerated/Editor/Utils.cs:96)
LoginScriptJS+$doLogin$4+$.MoveNext () (at Assets/_Scripts/Managers/GameManager/LoginScriptJS.js:51)
I can access the file fine. I even CHMOD'd it to 777. I've tried on a local server and a paid server with a .com domain.
Is there no override for it while I'm just trying to test a small amount of code? What a pain...
perhaps the format of your crossdomain file is wrong? can you post it without sharing the security?
http://www.sendspace.com/file/38dza5 - I tried encoding to different formats using notepadd++. The docs say to make it an ASCII file, but only ANSI/UTF-8/etc were available.
I have even saved somebody elses workingfile (http://theinvestigator.net/crossdomain.xml) and uploaded that to the root.
Try opening it with vi on the sever and saving. That solved it for me.
I was getting this error and then found, (maybe because I was using a tcp socket, not the WWW class) that it was not a http request to port 80 for this file but rather a raw tcp (telnet) request to port 843 for the ascii cross domain xml policy.
So you test it by: /> telnet hostname 843
Could anyone supply the URL of an image on a domain which is definitely known to work? I just can't get this image loading working - tried everything - it was never this difficult in Flash :)
Answer by Eydamson · Apr 24, 2013 at 02:29 PM
i found the solution. just go to edit>project settings>editor> the change the default host url to your own host url, host url means your sever url. it will work even without the crossdomain.xml file :)
Thanks a lot.. THis should have been the accepted answer.
Answer by BerggreenDK · Sep 04, 2011 at 08:48 PM
<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*.yourdomain.com" />
</cross-domain-policy>
1) have you tried it when specifying the top and sublevel domain?
2) can you access the file from a normal browser on the real url? like: http://yourdomain.com/crossdomain.xml
if you CAN'T download it from a normal browser, you have a webserver READ access problem, not a crossdomain.xml problem, I think.
You could also try to add localhost as an allowed domain for local testing:
<allow-access-from domain="localhost" />
1) I tried that version and the localhost one, but still not happening. 2) Yes I can access it the same as theinvestigator.net's. I have to give up for today.
if you want, you can mail me your domain in a private way and then I will see if I can open it from my location? I've just created this mail-alias: unitytest1@berggreens.dk so if it gets spammed I can remove it instantly. Feel free to contact me that way.
I have found that the cross domain policy is not requested over http but rather a raw socket. It doesn't matter where you put the policy as long as you get it is servered from port 843 as ascii text. You can test if it works by doing:
telnet yourdomain.com 843
^ I don't know why there is a http:// up there i did not write that...
Answer by Leslie-Young · Sep 10, 2011 at 08:40 PM
It should be
<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>
note **domain=""*
as stated in the docs. I had the same problem until I tried that.
if you follow his link, you can see that already has domain="*" inside it. So its not that I think.
Well, that does not make my answer incorrect cause that is what it shoud look like rather than your domain="*.yourdomain.com" which did not work for me on a google app engine hosted app.
Strange, because I run my tests on 4 different locations and they all work with *.domain.com
So if I wanted to say "*.some_domain.com" .. is that supposed to work? and what would be the difference between using "*" and "*...com" ? I'm new to this crossdomain stuff, actually found this topic while doing a search against the error message that Unity dumped and then realised from reading here that there should be docs about this.
Its not that I wont try to help you solve your problem, but doesnt this belong in a new question?
Answer by jahroy · Sep 12, 2011 at 09:14 PM
Try opening and saving the file on the server with vi.
That's the only way I was able to get mine to work...
ssh to server
open crossdomain.xml with vi
save file
enjoy
To open a file named crossdomain.xml with vi, type the following at the command line:
vi crossdomain.xml
To save it, type the following:
ZZ
(that's capital 'Z' two times)
Note you can substitute the editor of your choice.
The whole point of opening and saving is to make sure the encoding is suitable.
I don't know how to use vi.. can anyone just post their working crossdomain to see if this is just a silly coding issue? I've tried everything else I've read on the issue for days. worked on standalone. I have "http://localhost/scores.php" as my scripts target. why is this so impossible when it says right in the docs that crossdomain.xml is not needed in local host setups?? all permissions in ftp are set to 775 atm.
Is it really that hard to open a file and save it with vi?
I added some instructions just in case...
Answer by andresp · Mar 14, 2012 at 04:20 PM
Make sure you are saving the file in UTF8 without BOM (Byte Order Mark)
Your answer
Follow this Question
Related Questions
crossdomain.xml on Server Requiring Basic Authorization 0 Answers
CrossDomain AllowAccessFrom * do not work 1 Answer
WWW Post doesn't work. 2 Answers