Setting up a BOSH server
XMPP over BOSH (previously known as ‘HTTP binding’ or “http-bind”) is a technology to use XMPP over HTTP, the protocol that powers the web. This allows XMPP applications to run in web pages, but also any other HTTP-only environment such as behind restrictive firewalls.
As well as BOSH, you should also consider enabling mod_websocket, a more modern alternative. You can enable both at the same time for broad client compatibility.
This page acts as a guide to setting up Prosody as a BOSH server for the first time.
Note: An alternative solution to that described here is to set up an external BOSH connection manager, which acts as a proxy between BOSH clients and normal XMPP to Prosody (and also to any other server). For a list of these, see the list of BOSH connection managers on xmpp.org (all should be compatible with Prosody).
Enabling the module
Firstly load the ‘bosh’ module, or add it to your modules_enabled line in your config file. Restart Prosody.
Configuring
You will find BOSH accessible at the following URL by default:
Check everything is working with the following command (Prosody 0.12+):
prosodyctl shell module info bosh
If you want to customize the URL or reverse proxy it through your web server, check out the general Prosody HTTP server documentation.
Cross-domain access
On Prosody 0.11 and earlier, you need to enable cross-domain (CORS) support so web clients can access your BOSH URL:
= true cross_domain_bosh
This step is not necessary in Prosody 0.12 and later.
For more discussion about cross-domain access, see Cross-domain (CORS) support in our main HTTP configuration guide.
Tested clients
These clients and libraries support BOSH and have been tested against Prosody:
For developers, the following libraries support BOSH:
- Strophe.js (Javascript)
- gloox (C++)
- xmpp.js (Javascript)
- Verse (Lua)
There are probably others!