set proxy in apache for XMPP chat

Posted by Hunt on Server Fault See other posts from Server Fault or by Hunt
Published on 2012-02-06T15:36:42Z Indexed on 2012/11/01 17:04 UTC
Read the original article Hit count: 471

Filed under:
|
|
|

I want to setup a proxy settings in Apache to use Facebook XMPP Chat

So far I have setup ejabber server and I am able to access xmpp service using

http://mydomain.com:5280/xmpp-http-bind

I am able to create Jabber Account too.

Now as I want to integrate Facebook XMPP chat , I want my server to sit in between client and chat.facebook.com because I want to implement Facebook chat and custom chat too.

So I have read this article and come to know that I need to serve BOSH Service as a proxy in apache to access Facebook Chat service.

So I don't know how to set up a proxy in a apache httpd.conf as I have tried following

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /xmpp-httpbind http://www.mydomain.com:5280/xmpp-http-bind
ProxyPassReverse /xmpp-httpbind http://www.mydomain.com:5280/xmpp-http-bind 

But whenever I request http://www.mydomain.com:5280/xmpp-http-bind from strophe.js I am getting following response from server

<body type='terminate' condition='internal-server-error' xmlns='http://jabber.org/protocol/httpbind'>
   BOSH module not started
</body>

and server log says following

E(<0.567.0>:ejabberd_http_bind:1239) : You are trying to use BOSH (HTTP Bind) in host "chat.facebook.com", but the module mod_http_bind is not started in that host. Configure your BOSH client to connect to the correct host, or add your desired host to the configuration, or check your 'modules' section in your ejabberd configuration file.

here is my existing settings of ejabberd.cfg , but still no luck

  {5280, ejabberd_http, [
                        {access,all},
                         {request_handlers,
                          [
                           {["pub", "archive"], mod_http_fileserver},
                           {["xmpp-http-bind"], mod_http_bind}
                         ]},
                         captcha,
                         http_bind,
                         http_poll,
                         register,
                         web_admin
                        ]}

 ]}.

in a module section

 {mod_http_bind, [{max_inactivity, 120}]},

and whenever i fire http://www.mydomain.com:5280/xmpp-http-bind url independently
am getting following message

ejabberd mod_http_bind

An implementation of XMPP over BOSH (XEP-0206)

This web page is only informative. To use HTTP-Bind you need a Jabber/XMPP client that supports it.

I have added chat.facebook.com in a list of host in ejabber.cfg as follows

{hosts, ["localhost","mydomain.com","chat.facebook.com"]}

and now i am getting following response

<body xmlns='http://jabber.org/protocol/httpbind' 
            sid='710da2568460512eeb546545a65980c2704d9a27' 
            wait='300' 
            requests='2' 
            inactivity='120' 
            maxpause='120' 
            polling='2' 
            ver='1.8' 
            from='chat.facebook.com' 
            secure='true' 
            authid='1917430584' 
            xmlns:xmpp='urn:xmpp:xbosh' 
            xmlns:stream='http://etherx.jabber.org/streams' 
            xmpp:version='1.0'>
    <stream:features xmlns:stream='http://etherx.jabber.org/streams'>
    <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <mechanism>DIGEST-MD5</mechanism>
        <mechanism>PLAIN</mechanism>
        </mechanisms>
    <c xmlns='http://jabber.org/protocol/caps' 
       hash='sha-1' 
       node='http://www.process-one.net/en/ejabberd/' 
       ver='yy7di5kE0syuCXOQTXNBTclpNTo='/>
       <register xmlns='http://jabber.org/features/iq-register'/>
     </stream:features>
    </body>

if i use valid BOSH service created my jack moffit http://bosh.metajack.im:5280/xmpp-httpbind

then i am getting following valid XML from facebook , but from my server i am not getting this

<body xmlns='http://jabber.org/protocol/httpbind' 
    inactivity='60' 
    secure='true' 
    authid='B8732AA1'
    content='text/xml; 
    charset=utf-8' 
    window='3' 
    polling='15' 
    sid='928073b02da55d34eb3c3464b4a40a37' 
    requests='2' 
    wait='300'>
    <stream:features xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client'>
    <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
        <mechanism>X-FACEBOOK-PLATFORM</mechanism>
        <mechanism>DIGEST-MD5</mechanism>
    </mechanisms>
    </stream:features>
</body>

Can anyone please help me to resolve the issue

© Server Fault or respective owner

Related posts about facebook

Related posts about apache2