Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Jul 28 '12 at 20:05

This question came from our site for professional and enthusiast programmers.

    
did you solved this issue? –  Shlomi Schwartz Jul 25 '12 at 14:14
    
Nope ! still hunting for it , it seems you got to enable some certificate –  Hunt Jul 25 '12 at 16:37
    
Thanks for the input, I will post if I'll find the answer –  Shlomi Schwartz Jul 25 '12 at 16:42
    
Sure Buddy , will wait :) n hope you will find it –  Hunt Jul 25 '12 at 18:07

2 Answers 2

Your link seems to miss some important ejabberd settings. But the message is quite clear:

the module mod_http_bind is not started in that host

So, first, you must ensure you have the http-bind module in ejabberd:

{modules,
 [
 (...a lot of modules here...)
{mod_http_bind, [{max_inactivity, 120}]}
 (...and maybe some others here...)
]}.

max_inactivity is maybe not available for you, it's a quite recent setting. Default is 30s.

Then you need to ensure it's activated in your c2s (Client To Server) listening port for bosh (5280 here):

{listen,
 [
 (...a lot of listener here...)
   {5280, ejabberd_http, [
       {request_handlers,
         [
          {["http-bind"], mod_http_bind}
         ]},
       http_bind
       web_admin
       ]
    }
 (...and maybe some others here...)
]}.

Apart from that you should study using nginx for the proxy, depending on your amount of traffic, Apache handling of parallel requests may suffer a lot from BOSH Keepalive traffic.

share|improve this answer
    
i have updated my qestion with ejabberd.cfg settings , i tried those but i am getting same response , so wht to do further ? –  Hunt Feb 7 '12 at 5:06
    
try to use the default http-bind url instead of xmpp-httpbind? –  regilero Feb 7 '12 at 9:34
    
i have changed it but no luck , do i need to change anything in "pub", "archive" for mod_http_fileserver? –  Hunt Feb 7 '12 at 13:43
    
mod_http_fileserver is unrelated, try to remove it first, and remove http_poll, captcha and register. Try to reduce the configuration to the most basic setup. Check you do not have several name based hosts and that this module is really activated for the right host. Increase loglevel to 5 and check the logs. –  regilero Feb 7 '12 at 16:51
    
i tried what you have said and moreover i have added chat.facebook.com in my host list , please see the edits in question –  Hunt Feb 7 '12 at 17:16

After more then a week of struggle I got a custom Facebbok chat to work, I switched to punjab instead of the ejabberd server and all works fine. so basically the structure is:

Strophe.js <-> Apache (proxy) <-> punjab <-> Facebook XMPP server

share|improve this answer
    
which BOSH Url are you using ? i mean is that a custom one ? –  Hunt Jul 29 '12 at 8:49
    
my BOSH url is localhost:5280/http-bind/ but I use a virtual host proxy so the link is localhost/http-bind/. here is the vhost code:<Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /http-bind localhost:5280/http-bind nocanon ProxyPassReverse /http-bind localhost:5280/http-bind –  Shlomi Schwartz Jul 29 '12 at 9:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.