webplayer crossdomain in sub directory

Hi, I met one weird issue. I use easyphp as my webserver. I put one php file under the root directory of apache in it. Then I got success in my webplayer binary to access it. Then I put one sub directory under the root directy of apache, which contains many small files. Then in webplayer binary, I use WWW to get those small files, but unfortuntely I failed. Then I did some debugging. 1. I put another exactly same crossdomain file under the sub directory also, still fail. 2. I added one debug message before I use WWW, I used the security.PrefetchSocketPolicy before WWW, it returns fail when I try to get the crossdomain file under the sub-directory.

Any help here? I guess I just stunk at some simple point I just don't know yet..

I'm not 100% sure I understand your question, but the crossdomain.xml file always needs to be at the root level of the web server, not in the same subdirectory as the files you want to access.

If you're accessing the file from http://my.domain/f1/sf2/asdf.hp, then the crossdomain.xml must be at the address http://my.domain/crossdomain.xml. If you're accessing the file from http://www.my.domain:1234/f1/sf2/asdf.hp, then the crossdomain.xml must be at the address http://www.my.domain:1234/crossdomain.xml. It must be available right there, without any "HTTP 302 Found" redirections. To test, you may use a command-line HTTP client called "wget":

wget.exe --max-redirect=0 http://www.my.domain:1234/crossdomain.xml

P.S. I think I know what confused you.

In Unity, there're 2 different crossdomain policies: one for HTTP protocol that is used with WWW class, another one for sockets. Those are similar but completely different mechanisms.

The WWW crossdomain.xml must be available through the higher-level HTTP protocol. The sockets crossdomain.xml is requested using the low-level TCP protocol. The XMLs itself are different: WWW must include , socket must also specify the ports range, e.g. "".

Security.PrefetchSocketPolicy is only for the socket crossdomain.xml. If you only use WWW class, calling it does nothing, and fail means nothing. To serve the socket's crossdomain.xml you don't need a web server such as Apache, instead you'll need completely different software running on your server. And AFAIK providing valid socket's crossdomain.xml still doesn't allow the WWW requests to succeed, it only enables lower-level socket communication with the host.