Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running an Openfire XMPP server on a virtual hosting service. When I sent an XmlHttpRequest to that server by Javascript, I got the error from Chrome's dev console:

"XMLHttpRequest cannot load http://myxmppsite.com:9090/plugins/userService/userservice?type=add&secret=3VC72j0t&username=kafka&password=drowssap&name=franz&email=franz@kafka.com. Origin http://myanothersite.com is not allowed by Access-Control-Allow-Origin."

But when I browsed to the url directly from Chrome, it worked normally.

I googled some stuffs and modified the xmpp server's cross-domain-policy to allow requests and request headers from myanothersite.com but it still didn't work.

How can I edit the Access-Control-Allow-Origin (whatever it is) so that I can allow myxmppsite.com to accept requests from myanothersite.com?

Thanks in advance.

share|improve this question

1 Answer 1

You have to use JSON-P or apache/nginx proxy running on the same host.

You can check this post for more details Orgin x is not allowed by Access-Control-Allow-Origin

share|improve this answer
    
Thanks, I tried those methods but still didn't work. I guess the problem is sth else. Anw, I figured that host wouldn't block itself, so I transfered the code from the other host to it, and it worked :) –  giang271291 Feb 8 '12 at 12:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.