3

Im trying to create a webchat using Jabber. I have installed Openfire and i can login to the admin panel at :9090 so the server is running.

Now when using strophe.js basic example, coming with strophe.js i get this error:

5XMLHttpRequest cannot load http://jabber.xxx.dk:7070/http-bind/. Origin http://jabber.xxx.dk is not allowed by Access-Control-Allow-Origin.

How can i allow the domain?

Danielss89
  • 863
  • 1
  • 11
  • 17
  • For anyone new to this here is a getting-starting tutorial to set this all up, https://expertnotfound.wordpress.com/2013/04/08/setting-up-openfire-bosh-strophe/. – Kyle Bridenstine Mar 22 '16 at 15:16

5 Answers5

6

If it doesn't work even after enabling CORS in Openfire and changing the domain policy to accept all, then check your URL for Openfire. You may need to add '/' at the end (e.g. 'http://dimain:7070/http-bind/').

Without the slash it didn't work for me.

Jeff B
  • 8,572
  • 17
  • 61
  • 140
kris
  • 73
  • 1
  • 2
6

Thanks to @SamGoody for pointing this out. As of version 3.8.0, OpenFire now supports1 CORS[2], which is needed for your use case. To enable it, go to the OpenFire admin console, Server, Server Settings, HTTP Binding tab. Ensure that "Provides support for CORS (Cross-Origin Resource Sharing)" is Enabled, with a domain list of * (these are the defaults).

OpenFire admin screen

Joe Hildebrand
  • 10,354
  • 2
  • 38
  • 48
2

Another option is to setup your apache server to proxy port 7070 so you're not dealing with cross-domain issues per se. The code for that looks something like this inside of your httpd.conf file:

ProxyRequests Off
ProxyPass /http-bind http://127.0.0.1:7070/http-bind/
ProxyPassReverse /http-bind http://127.0.0.1:7070/http-bind/
monvural
  • 228
  • 1
  • 12
0

If you log in to the admin panel, go to the Server Settings tab, then to HTTP Bindings, check both options (HTTP Binding and Script Syntax) are set to Enabled

Marc
  • 546
  • 5
  • 10
  • They are both enabled, and port is set to 7070. This is the cross-domain policy: – Danielss89 Mar 26 '11 at 09:09
  • is /http-bind/ the default folder? should i do something to create this folder? – Danielss89 Mar 26 '11 at 09:10
  • I'm afraid I haven't got experience with HTTP binding, only Openfire itself. Now that it's not a simple configuration issue, it's out of my depth but hopefully someone else can provide an answer. – Marc Mar 26 '11 at 15:23
-2

I had faced same issue and come to know that port was not open for access. Though it browser says it is CORS Access-Control-Allow-Origin issue. This is sometimes open port issue. Please make sure http bind port is open and can be accessible over tcp on system your are testing.

Sushilkumar
  • 831
  • 7
  • 3