1
votes

My site is protected With SSL when i try to call XMPP Chat server is showing this error.

Mixed Content: The page at 'https://localhost:44300/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://192.168.30.1:5280/http-bind/'. This request has been blocked; the content must be served over HTTPS.

how to add ssl to ejabberd/XMPP chat server

pls Help Me am new to this

2
Could you show how you point your js/web app to ejabberd serverRubycon
am using jsxc @RubyconShazvan Hanif

2 Answers

1
votes

how to add ssl to ejabberd/XMPP chat server

I think you need the option tls: true and the option certfile: ... Try something like this:

listen:
  - 
    port: 5280
    module: ejabberd_http
    request_handlers:
      "/ws": ejabberd_http_ws
      "/bosh": mod_bosh
      "/api": mod_http_api
      "/presence": mod_webpresence
    web_admin: true
    tls: true
    certfile: "/etc/ejabberd/server.pem"
1
votes

The reason why you have Mixed Content issue is not only because you did not setup ssl on your ejabberd server.

Actually it says about other issue:

  1. You site is up and running on HTTPS (https://localhost:44300/)
  2. From this HTTPS page you are trying to access not secure resource. By "not secure" I mean HTTP endpoint of your ejabberd server (http://192.168.30.1:5280/http-bind/')

So that's why you see this issue.

How to fix?

You need to access your ejabberd server by secure endpoint (HTTPS), so you should have this url https://192.168.30.1:5280/http-bind/ in your JS app code.

I'm not familiar with jsxc, but I found this getting started guide https://github.com/jsxc/jsxc/wiki/Install-jsxc#2-configure so your config should have HTTPS instead of HTTP, e.g:

  xmpp: {
     url: 'https://localhost:5280/http-bind/',

After this, your Mixed Content issue should be resolved.

Probably, after it, you will face another issue that you did not setup SSL for your ejabberd server, but it relates to your ejabberd server config and not to your JS app.