Sign in to follow this  
hpdvs2

Unity Unity crossdomain issue

Recommended Posts

hpdvs2    1017

I posted this to the Unity forums as well, but they aren't as active as here in my experience.  (If I get the answer there, I'll post it here)

 

I'm somewhat new to Unity for an engine. My game is using WWW to get some info from my site. 

I'm running into "SecurityException: No valid crossdomain policy available to allow access"

I manually went to "crossdomain.xml" and resaved as UTF-8 (ASCII subset)

crossdomain.xml is loadable from the root of my site. (localhost) http://127.0.0.1/crossdomain.xml. I can open that in a browser and it pops up. 

The contents of the file is: 
<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>

The file it is grabbing from the site is an xml file, in a sub folder called Users. I wasn't sure if the crossdomain.xml file needed to be in the same folder as the content, so I have a copy of it there as well. Despite that, I keep receiving the error.

I've looked at a dozen pages/sites at least on this issue, and tried all sorts of things with now luck. 

I'm running Windows 8, with IIS. The page is on the IIS. I can access all the paths from a browser without issue.

Any clue what I'm doing wrong? - Thanks

Share this post


Link to post
Share on other sites
justkevin    252

Are you trying to run the unity game from the Unity IDE, or from a browser?

 

Try checking the IIS logs to see if you can see a request for the crossdomain.xml at the time you think Unity should be making the request.

Share this post


Link to post
Share on other sites
hpdvs2    1017

Try checking the IIS logs to see if you can see a request for the crossdomain.xml at the time you think Unity should be making the request.

 

I do see requests coming through.  I even cleared the log, and only used the game and tried again.  and saw some records for it.

 

So it appears it is able to get the file.  Log returns a 200 OK

2013-02-19 21:04:58 127.0.0.1 GET /crossdomain.xml - 80 - 127.0.0.1 UnityPlayer/4.0.1f2+(http://unity3d.com) - 200 0 0 1

 

 

 

 

You probably need to allow http request headers:

[source]<allow-http-request-headers-from domain="*" headers="*"/>[/source]

 

Thanks.  I tried this.  But unfortunately, I'm still getting the error.

 

SecurityException: No valid crossdomain policy available to allow access

 

I'm guessing this means there is something wrong with the crossdomain file.  either in structure or save format, but I'm not sure.  the exception doesn't give much more info.

 

P.S.  At this point, I've still had no responses on the Unity forum.  This forum rocks.

Share this post


Link to post
Share on other sites
swiftcoder    18437

I'm guessing this means there is something wrong with the crossdomain file.  either in structure or save format, but I'm not sure.  the exception doesn't give much more info.

All right, well, if that's the problem, I see three potential issues:
  • You are missing a doctype declaration.
  • You aren't setting a cross domain policy.
  • Your web server may not be setting the right content type
How about this?
 
<?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="*"/>
</cross-domain-policy>
And make sure your webserver is sending [tt]Content-Type: text/x-cross-domain-policy[/tt]

Share this post


Link to post
Share on other sites
CJ_COIMBRA    980

There are some security options you could double check under Edit -> Project Settings -> Editor, maybe it has something to do with those options when running from the editor. I had this same problem but it was a long time ago and I honestly cant remember what I did back there.

Share this post


Link to post
Share on other sites
Kylotan    10011

Are you sure the exception is for your WWW class usage? For WWW, the policy file needs to be served up over HTTP, but for socket use, the policy file needs to be served over plain TCP. If you were using both WWW and sockets, you would get an error like this where the WWW security check passed but the socket check did not.

 

Another idea: you can't use 127.0.0.1 and localhost interchangeably. Make sure your policy file is reachable using the exact same host name that is being used by the WWW class. Both should use localhost or neither should.

 

Also, UTF-8 is not an ASCII subset! It's the other way around. Your file looks like plain ASCII to me but make sure there is no Byte Order Mark at the start of the file or anything like that. Switch your text editor to an ASCII encoding if possible.

Share this post


Link to post
Share on other sites
hpdvs2    1017

I'm guessing this means there is something wrong with the crossdomain file.  either in structure or save format, but I'm not sure.  the exception doesn't give much more info.

All right, well, if that's the problem, I see three potential issues:
  • You are missing a doctype declaration.
  • You aren't setting a cross domain policy.
  • Your web server may not be setting the right content type
How about this?
 
<?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="*"/>
</cross-domain-policy>
And make sure your webserver is sending [tt]Content-Type: text/x-cross-domain-policy[/tt]

 

 

You rock!  This xml solved it.

 

this probably would have been solved earlier had I noted your first response with the header xml.  I noticed and added the attribute, but did not notice the fact it was a different node/tag.    That was probably my original problem.  

 

Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Partner Spotlight

  • Similar Content

    • By Spronx
      Hi guys,
      I'm Andy from StriX Interactive and we are
      LOOKING FOR A LEVEL DESIGNER
      to join us on this incredible adventure of developing Blood Oath. Open world fantasy 3rd person RPG in the style of The Witcher.
      We plan to launch a Kickstarter campaign by the end of the year. So it's not a paid job yet.
      We need someone capable of making terrain according to the world map that we have and over all level design. We have a great team and want YOU to be a part of it.
      Contact us on our facebook page https://www.facebook.com/StriXInteractive/

    • By Java Nigga
      Hi there!
      We are JN Studios, we are looking for people to work with us in our project.
      About US:
      JN Studios is a 2 people amateur studio. we have like 1 year making games, but this is our first professional project to show it to the public. We are a programmer guy(Me) and a 3d modeller.
      About the game:
      Strategist Sniper is a RPG/FPS game, yes RPG and fps :v you awake in the middle of the unknown and a small voice tells you that you have to go through the world killing other snipers to get out of there. the mechanics of the game are based on the basic controls of games like League of Legends and in FPS games like Counter Strike.
      What we are looking for?
      actually we are looking for another c# programmer, a musician and an artist(for game illustrations for the marketing of the game).
      Profits Share:
      when the game is in a stable alpha phase we will create a campaign in Idiegogo to obtain money to finance the game. each of the project participants will receive a percentage depending on the work done.
      How to apply?
      just send us a email with a portfolio and in what you can help our team -       trabajojava1@gmail.com


      Devblog1.mp4
    • By cursetalegame
      Hello! I am building the main scene in Unity for a 3D cards game. My goal is creating "card slots" to place the different cards from a deck and use it as "buttons". The image below represents somehow what I want to develop. I have been reading and I think that I have to generate a canvas and place in my scene the slots where I want to place the cards, but I am not sure about it. Also, to use the cards, I don't know if setting buttons is the best option (maybe I should use images instead).
      All recommendations and tips are welcome

    • By cursetalegame
      Hi! We are looking for a unity 3D developer to join our small "beginners" team. We are 3 artists (illustration, concept and 3D modeling), 2 designers and 1 programmer (me). We are developing an online video game that we have already designed. Our goal is to create a small studio and build up this game to take it to video game events around Europe and try to find publishers. Also we want to learn step by step how to develop games, so, is better if you don't have a huge experience in developing
      For more information, or any question, you can send us an email to cursetalegame@gmail.com 
      Cheers
    • By ilovegames
      The legendary UAZ SUV is off in an unprecedented expedition on the picturesque,
      yet rugged regions of Russia. Powerful domestic cross-country vehicles have to go through many trials in the expanses of the country! There are three game modes (Exploring the world, Delivery and Checkpoints).
      Explore the vastness of Russia, perform tasks, and feel the power of the legendary UAZ!

      Features:
      - Large Map.
      - Diverse terrain (mountains, villages, fields, etc.)
      - Modern graphics and effects.
      - Pleasant music.
      - 11 types of camera views.
      - Different weather conditions (fog, rain, etc.)
      - Game modes (Free Driving, Delivery & Checkpoints)
      - 3 models of the legendary brand.
      - And much more!
      Download https://falcoware.com/UazOffRoadNewHorizon.php




  • Popular Now