Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Crossdomain problems

Discussion in 'Editor & General Support' started by jrbitt, Oct 18, 2010.

  1. jrbitt

    jrbitt

    Joined:
    Oct 18, 2010
    Posts:
    5
    Hi
    I have some problem with crossdomain,xml
    I've done a web player build of my game. My game uses WWW class and accessing to domain http://amazonia.muraset.com:8080. In this server has a lot of web services for my game and contains the crossdomain.xml in http://amazonia.muraset.com:8080/crossdomain.xml

    <?xml version="1.0"?>
    <cross-domain-policy>
    <allow-access-from domain="*" to-ports="8080"/>
    </cross-domain-policy>


    I test in my PC, in locahost and webplayer crashes always.

    The log shows it:

    (...)
    Platform assembly: C:\Users\jrbitt\AppData\LocalLow\Unity\WebPlayer\player\3.x.x\Data\lib\CrossDomainPolicyParser.dll (this message is harmless)
    About to parse url: http://amazonia.muraset.com:8080/MuraConnectServer/mura/core/getCoreServers
    luccheck6
    About to parse url: http://amazonia.muraset.com:8080/crossdomain.xml
    luccheck6
    About to parse url: http://amazonia.muraset.com:8080/MuraConnectServer/mura/core/getCoreServers
    luccheck6
    About to parse url: http://amazonia.muraset.com:8080/MuraConnectServer/mura/core/getCoreServers
    luccheck6
    About to parse url: http://amazonia.muraset.com:8080/MuraConnectServer/mura/core/getCoreServers
    luccheck6


    PS: (repeat this two last statement a lot of times until the log file has 3 Mb!!)

    Please, someone could help me?

    Thanks a lot!!
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    did you try it on the right place ie amazonia.muraset.com/crossdomain.xml without the port?
    because I think thats where unity will search, it will ignore the port you use for the request, it will use the domain only
     
  3. jrbitt

    jrbitt

    Joined:
    Oct 18, 2010
    Posts:
    5
    Hi my friend
    Thanks for fast answer

    I tried to put direct in amazonia.muraset.com/crossdomain.xml without port with crossdomain.xml and file with and without to-ports="8080"
    It's important to say that I can't remove 8080 because it redirect to Tomcat :-(

    But continues same error in log and crashing browser

    Other suggestion?

    Thanks for help

     
  4. jrbitt

    jrbitt

    Joined:
    Oct 18, 2010
    Posts:
    5
    Hi friends
    The problem continue, please I need some help

    I've done the following test: I put crossdomain in http://www.ludensartis.com/crossdomain.xml and http://amazonia.muraset.com/crossdomain.xml I've create a web player and hosted in http://www.ludensartis.com/WebPlayer/WebPlayer.html
    In button "Ludens" there a code to get by WWW class the image in http://www.ludensartis.com/deisproject/Images/logo.png
    And in button "Mura" I've try to get http://amazonia.muraset.com/crossdomain.xml file.

    Always crash the app!! Following the error

    Platform assembly: C:\Users\jrbitt\AppData\LocalLow\Unity\WebPlayer\player\3.x.x\Data\lib\CrossDomainPolicyParser.dll (this message is harmless)
    About to parse url: http://www.ludensartis.com/deisproject/Images/logo.png
    luccheck6

    I use this code to connect URLs

    private void active(string url){
    WWW con = new WWW(url);
    while(!con.isDone) {}
    txtValue = con.text;
    }

    The same for Mura but change the URL

    Thanks a lot!!
     
    Last edited: Oct 22, 2010
  5. tomvds

    tomvds

    Joined:
    Oct 10, 2008
    Posts:
    1,028
    We're experiencing the exact same problem (i.e. not being able to access files on the same domain because of luccheck6). Is there anybody here who knows anything about how this crossdomain stuff works and what we may be doing wrong?
     
  6. Arpan

    Arpan

    Joined:
    Dec 7, 2010
    Posts:
    2
    I am facing this same issue as well. It is very weird - everything works as expected when played within the Editor, but when I build a Web-Player version and open it in a browser, it goes into an infinite loop printing out the following (in the log file):
    About to parse url: <URL>
    luccheck6


    I noticed that this issue doesn't show up when using WebRequest, it only occurs with WWW. When using WebRequest, it's a different problem - a "NotSupportedException" is thrown, similar to this post.

    The end result is that the Web-Player is unable to make any requests over the web! If anyone has been successful in doing that, it will be very helpful if we could look at the relevant portion of your code. Note that this problem is only there when you are trying to run the Web-Player within a browser. I'm sure it's not a cross-domain issue as I have the required crossdomian.xml file in the right place, and it's all working fine when played within the Editor (the Editor emulates a Web-Player's secure environment, see this).
     
  7. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    WebRequest can not be used with Unity, especially not the webplayer.

    And yupp get the same problem with luccheck6, BUT only if I try to access the file with Application.dataPath +relativePath
    If I just use the relativePath, there is no problem and it works fine!
     
  8. Arpan

    Arpan

    Joined:
    Dec 7, 2010
    Posts:
    2
    Thank you for your response, dreamora. But relative path is not an option for me as the web service I'm trying to access (a servlet, to be specific) resides somewhere else.

    I have a simple question then - how do Unity web-playable games make requests to external servers, for keeping high scores and such? There's got to be a way!
     
  9. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
  10. dimitrios

    dimitrios

    Joined:
    Dec 14, 2010
    Posts:
    1
    Is there a suggested solution to the fact that sometimes there is no server responding to port 80, only on the specified port?

    I am using tomcat as a previous poster mentioned and while it may be feasable to manually configure it to listen on port 80 instead of 8080, it is definitely not practical in our scenario.
     
  11. Lucas Meijer_old

    Lucas Meijer_old

    Joined:
    Apr 5, 2008
    Posts:
    436
    the 3mb logfile with 'luccheck6' is a bug, and will be fixed in the next Unity release.

    We are not aware of any bugs with the crossdomain.xml system. If you have a reproducable case
    where you feel it should work, but instead it doesn't, I would love to know about it.

    A few questions: when you say "it crashes", what does that mean? does the browser actually shut down?
    do you get a SecurityException?

    I just checked our internal testsuite for this failure, and I have a testcase that is working correctly, which is trying to do this:

    do a www request for: "http://otherdomain.com:507/myfile.txt"
    while hosted on "http://mydomain.com";
    with a crossdomain.xml hosted at "http://otherdomain.com:507/crossdomain.xml"

    where the crossdomain.xml contains this content:
    <?xml version="1.0" ?>
    <cross-domain-policy>
    <allow-access-from domain="*" />
    </cross-domain-policy>

    This works for me. If you can write down which url you are quering, where you placed a crossdomain, with which content, and the url at which your game is hosted, together with the code you're using to make the WWW request, we can hopefully figure out what's going on.

    Bye, Lucas
     
  12. manarius

    manarius

    Joined:
    Nov 4, 2009
    Posts:
    3
    hi ppl :)
    i am currently testing things on a temporary url...
    http://why-am-i-an-anarchist.co.cc/unityoutput/WebPlayer.html

    and i try to call
    http://why-am-i-an-anarchist.co.cc/unityoutput/index.php

    i tried:
    absolute path, relative path in same folder, relative path in a subfolder
    nothing worked :(

    crossdomain.xml looks exactly like yours.

    code that seems to trigger the error.

    Code (csharp):
    1. public void Request ( WWWControl caller, string url, float timeout) {
    2.     WWW wwwx = new WWW(url);
    3.     float stop = Time.time+timeout;
    4.     while ((!wwwx.isDone)  (stop > Time.time)) {
    5.         StartCoroutine(SleepSecs(1));
    6.     }
    7.     if (wwwx.isDone) {
    8.         caller.RequestReturn ( wwwx.text);
    9.     } else {
    10.         Debug.Log("timeout!");
    11.     }
    12. }
    13.    
    14. IEnumerator SleepSecs (float secs) {
    15.   yield return new WaitForSeconds(secs);
    16. }
    it works in the editor
    it works when i call the file locally, if i use an absolute path
    but once i try to call it using the uploaded file it fails.

    i tested in chrome, firefox and opera,
    chrome and firefox let the tab die and requested me to stop the non responding unity player
    while opera crashed completely and caused (i guess) a buffer overflow that crashed chrome, firefox and opera ;)

    once you looked at the examples above here is the link to the file as it should be,
    http://www.why-am-i-an-anarchist.co.cc/unityoutput/test/WebPlayer.html
    its just a first test, but i still hope you enjoy the fireworks ;)

    one last question:
    when will the update come that you mentioned in your post?
    i am on a tight deadline to get the game done for the kongregate-contest :)

    btw i am using an old class i wrote back then, maybe i hit a deprecated function (although i checked and it seems not)

    edit:
    i am using http://nginx.org as http server, maybe the error hides in that fact?


    greetings and thanks,
    manarius
     
    Last edited: Feb 1, 2011
  13. manarius

    manarius

    Joined:
    Nov 4, 2009
    Posts:
    3
    should i submit this as a bug?
     
  14. tomvds

    tomvds

    Joined:
    Oct 10, 2008
    Posts:
    1,028
    Perhaps, but first I would verify the code and make sure it is in fact the cross domain that is the problem. For example, I don't think your Request function is working as you intend it. The StartCoroutine(SleepSecs(1)); line will effectively do nothing (i.e. after calling StartCoroutine it will continue instantly instead of after 1 second). If you want to wait for execution of a Coroutine, you must use yield return StartCoroutine(...) (and Request would need to be a coroutine itself).