0
votes

I am trying to connect my Strophe client to the Ejabbered server but am getting 404 error everytime am trying to connect to the server.

below is the error log:

Failed to load http://localhost:5280/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4400' is therefore not allowed access. The response had HTTP status code 404.

My Strophe connection code:

window.addEventListener("load", function(){ conn = new Strophe.Connection("http://localhost:5280/http-bind"); conn.connect(localStorage.getItem("username") + '@localhost', localStorage.getItem("password"), OnConnectionStatus); }, false);

1

1 Answers

0
votes

configure your web server and proxy reverse and file hosts tu domain it should be installed as im.server.com

127.0.0.1 localhost
192.168.0.1 im.server.com

Apache httpd.conf:

ProxyRequests Off
<Proxy *>
   AddDefaultCharset UTF-8
   Options +MultiViews
  Order deny,allow
  Deny from all
  Allow from all
</Proxy>
ProxyPass /httpbind http://localhost:5280/http-bind/
ProxyPassReverse /httpbind http://localhost:5280/http-bind/

RewriteEngine On
RewriteRule /httpbind http://localhost:5280/http-bind/

Header set Access-Control-Allow-Origin: "*"
Header set Access-Control-Max-Age "1000"
Header set Access-Control-Allow-Headers "X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding"
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"