Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Rejected because no crossdomain.xml policy file was found

Discussion in 'Editor & General Support' started by tango209, Feb 28, 2011.

  1. tango209

    tango209

    Joined:
    Feb 23, 2011
    Posts:
    379
    Hello,

    I've read damn near every thread I can find on crossdomain.xml and Unity3D, but I am still having problems pushing my game to my hosting site (discountasp.net). I'm using WWW calls to my .NET web service but always get 'Rejected because no crossdomain.xml policy file was found' errors.

    Example call:
    Code (csharp):
    1. WWW www = new WWW("http://mysite.com/Service.asmx/GetData",...);
    My crossdomain.xml file:
    Code (csharp):
    1. <?xml version="1.0" ?>
    2. <cross-domain-policy>
    3.   <allow-access-from domain="*"/>
    4.   <allow-access-from domain="mysite.com"/>
    5.   <allow-access-from domain="www.mysite.com"/>
    6.   <allow-access-from domain="mysite.webXXX.discountasp.net"/>
    7.   <allow-access-from domain="webXXX.discountasp.net"/>
    8.   <allow-access-from domain="discountasp.net"/>
    9.   <allow-access-from domain="localhost"/>
    10. </cross-domain-policy>
    Firebug shows my unity3d file coming from 'mysite.com' domain, but the crossdomain.xml file shows as coming from 'localhost'. The crossdomain file is retrieved successfully.

    I'm at a loss at this point. Should the crossdomain file show as coming from 'localhost'? I'm not doing any cross domain calls explicitly, so why is it even looking for a crossdomain file? Why doesn't it honor the '*' domain in the crossdomain file to begin with?

    Any help would be appreciated,
    bob
     
  2. Cominu

    Cominu

    Joined:
    Feb 18, 2010
    Posts:
    149
    taken from: http://unity3d.com/support/documentation/Manual/Security%20Sandbox.html

    The format used for the socket policy is the same as that used by the Flash player except some tags are not supported. The Unity webplayer only supports "*" as a valid value for the domain setting and the "to-ports" setting is mandatory.

    Looks like the only supported value is "*" and the "to-ports" is always required.

    HTH
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    it must actually not be * (which would be there anyway, the other lines are all meaningless after the *), but the to-ports is indeed a must otherwise it has no valid port to connect to
     
  4. tango209

    tango209

    Joined:
    Feb 23, 2011
    Posts:
    379
    Hi Guys,

    Thanks for the responses. I was under the impression from the documentation that WWW calls didn't need the 'to-ports' attribute. I'm not using sockets, just plain old HTTP calls using the WWW class.

    I've used the example crossdomain.xml for the WWW on that page with the same results.

    Since I'm not doing any cross domain calls to begin with, why is it even checking the crossdomain.xml file? According to that page:

    It shouldn't be needed. Even so, Firebug shows that it pulls the crossdomain.xml file successfully.

    Thanks,
    bob
     
    Last edited: Mar 2, 2011
  5. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    and the file is at mysite.com/crossdomain.xml (more precisely mysite.com:80/crossdomain.xml)?
     
  6. tango209

    tango209

    Joined:
    Feb 23, 2011
    Posts:
    379
    I can pull the file with 'http://mysite.com:80/crossdomain.xml'. Though it does not pull it if the 'http://' is removed.
     
  7. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I just ommited the http, I expect Unity to search on the http actually. The other protocols (ftp, file, https) wouldn't make any sense :)

    your webservice does not do some strange redirection or return a different url along the header so unity could get confused or alike?
     
  8. tango209

    tango209

    Joined:
    Feb 23, 2011
    Posts:
    379
    It shouldn't be. They are simple ASMX calls, but I'll write a pure C# test client to see what the headers look like when I get home tonight.

    Thanks again for the help,
    bob
     
  9. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    using firebug and alike is likely faster for doing that :) or using a packet sniffer to analyze what your webplayer sends and receives in detail :)
     
  10. tango209

    tango209

    Joined:
    Feb 23, 2011
    Posts:
    379
    I used firebug and it retrieved the crossdomain.xml file. The one odd thing is that the Host is showing up as localhost. Is that normal? Here's the Request Headers:

    GET /crossdomain.xml HTTP/1.1
    Host: localhost
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.14) Gecko/20110218 Firefox/3.6.14
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 115
    Connection: keep-alive
    If-Modified-Since: Wed, 02 Mar 2011 02:13:30 GMT
    If-None-Match: "e6e3636c7fd8cb1:0"
     
    Last edited: Mar 3, 2011
  11. tango209

    tango209

    Joined:
    Feb 23, 2011
    Posts:
    379
    Well, it seems I forgot to remove the Editor setting pointing to localhost and that's why the host name was localhost. But, after removing that and uploading the new unity3d file I still get the same error with this request header for the crossdomain.xml request:

    GET /crossdomain.xml HTTP/1.1
    Host: mysite.com
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.14) Gecko/20110218 Firefox/3.6.14
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 115
    Connection: keep-alive
    If-Modified-Since: Thu, 03 Mar 2011 06:19:32 GMT
    If-None-Match: "1cf5df66ad9cb1:0"
     
  12. silencer

    silencer

    Joined:
    May 16, 2009
    Posts:
    80
    Any solution to this?
     
  13. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    What exactly are you doing? Codewise I mean
    Relative urls (ie files on the same domain) don't need the crossdomain.xml

    How does your crossdomain.xml thats in use right now look?

    If you want to use sockets / socket clients to talk to a server, then the policy server or an own policy server integrated in your server is the way to go
     
  14. silencer

    silencer

    Joined:
    May 16, 2009
    Posts:
    80