JWChat on ejabberd via lighttpd reverse proxy

Don't you hate it too if your employer tries to restrict you from using Jabber?

Instead of some fancy stuff like Jabber on port 80/443 (which won't work on better firewalls anyway), we'll install JWChat, a web-based Jabber client.
Of course there might be more sophisticated solutions, but this is pretty straightforward. Obviously don't use URLs that look too similar like instant messaging tools ;-)

So to start with, these are the requirements:

Lighttpd reverse proxy setup

Enable the proxy module:
# lighty-enable-mod proxy
Edit your lighttpd config file and add this snippet. This proxies requests from JWChat to the HTTP Binding interface of ejabberd. Make sure you enter an IP address for the proxy address as hostnames won't work.
$HTTP["host"] == "example.org" {
                proxy.server = ( "/http-bind/" => ( (
                        "host" => "127.0.0.1",
                        "port" => 5280
                        ) )
                )
}

Enable ejabberds' mod_http_bind

See ejabberd documentation.

Configure JWChat

Get rid of all unimportant language files:
# for a in $(ls *.en); do b=${a%.en}; cp $a $b; done
Then edit config.js and comment all other backends than:
var BACKENDS =
[

        {
                name:"Native Binding",
                description:"Ejabberd's native HTTP Binding backend",
                httpbase:"/http-bind/",
                type:"binding",
                servers_allowed:[SITENAME]
        },

Test it

# /etc/init.d/lighttpd restart
# /etc/init.d/ejabberd restart

Written on 27 May 2010 by Oliver Ladner. Last updated on 27 May 2010.