How do I configure the ejabberd server to access the bosh module in a lan network?

0

http://localhost:5280/bosh access normally   http://server.com5280/bosh What should I configure to access in this way?

I have configured the ejabberd.yml as follows:

port: 5280
ip: "::"
module: ejabberd_http
request_handlers:
  "/ws": ejabberd_http_ws
  ##"/a/b": mod_foo
  "/bosh": mod_bosh
  "/oauth": ejabberd_oauth
  "/api": mod_http_api
  "/pub/archive": mod_http_fileserver
web_admin: true
http_bind: true
register: true
tls: false ##si le pongo true no se visualiza la interfaz del servidor
certfile: "C:\ProgramData\ejabberd\conf\server.pem"
captcha: false

Host file configuration.

127.0.0.1       localhost       
::1             localhost
0.0.0.0         localhost
192.168.0.1     server.com  ##mi ip

web.config configuration

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <add name="Access-Control-Allow-Origin:" value="*" />
                <add name="Access-Control-Max-Age" value="86400" />
                <add name="Access-Control-Allow-Headers" value="Content-Type" />
                <add name="Access-Control-Allow-Methods" value="POST, GET, OPTIONS" />
            </customHeaders>
        </httpProtocol>
        <rewrite>
            <rules>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="^bosh/" />
                    <conditions>
                        <add input="{CACHE_URL}" pattern="^(https?)://" />
                    </conditions>
                    <action type="Rewrite" url="http://www.server.com:5280/bosh/" logRewrittenUrl="true" />
                    <serverVariables>
                        <set name="HTTP_ACCEPT_ENCODING" value="" /> 
                    </serverVariables>
                </rule>
            </rules>
            <outboundRules>
                <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
                    <match filterByTags="A, Form, Img" pattern="^/(.*)" />
                    <action type="Rewrite" value="/server.com/{R:1}" />
                </rule>
                <preConditions>
                    <preCondition name="ResponseIsHtml1">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                    </preCondition>
                </preConditions>
            </outboundRules>
        </rewrite>
    </system.webServer>
</configuration>

Strophe client connection

$(document).bind('connect', function (ev, data) {
    var conn = new Strophe.Connection(
        'http://server.com/bosh');
         conn.rawInput = rawInput;
         conn.rawOutput = rawOutput;


    conn.connect(data.jid, data.password, function (status) {
        if (status === Strophe.Status.CONNECTED) {
            $(document).trigger('connected');
        } else if (status === Strophe.Status.DISCONNECTED) {
            $(document).trigger('disconnected');
        }
    });

    Jchat.connection = conn;
});

Error by console

strophe.js:5662 POST http://server.com/bosh 404 (Not Found)
sendFunc    @   strophe.js:5662 > req.xhr.send(req.data);


sendFunc    @   strophe.js:5662
_processRequest @   strophe.js:5677
_throttledRequestHandler    @   strophe.js:5823
_connect    @   strophe.js:5170
connect @   strophe.js:3051
(anonymous) @   Jchat.js:438
handle  @   jquery.js:2693
(anonymous) @   jquery.js:2468
trigger @   jquery.js:2641
(anonymous) @   jquery.js:2919
each    @   jquery.js:692
each    @   jquery.js:155
trigger @   jquery.js:2918
Connect @   Jchat.js:271
(anonymous) @   jquery-ui.js:7387
handle  @   jquery.js:2693
(anonymous) @   jquery.js:2468

Failed to load http://server.com/bosh: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.0.1' is therefore not allowed access.
    
asked by Devid 14.06.2018 в 19:02
source

0 answers