Setup of Prosody with ASP.NET/IIS on a Shared Hosting with a web based XMPP Client

A web based XMPP client (such as Candy-Chat) communicates with Prosody (or other jabber server) via BOSH. BOSH basically enables a Jabber server to communicate with HTTP. The web client posts its traffic to the web server and the web server redirects the post to the BOSH interface on Prosody.

The first step to enabling an XMPP client is to enable BOSH in Prosody. Once Prosody is setup, ASP.NET/IIS requires some configuration as well.

To setup ASP.NET/IIS to communicate with the BOSH interface, a reverse proxy is required. The reverse proxy allows the web based XMPP client to post its messages to a fixed URL (normally /http-bind/). The reverse proxy intercepts the posts and acts as an intermediary to reroute traffic between Prosody's BOSH interface and the web client.

The simplest setup for a reverse proxy is by configuring IIS itself. This option is normally only available to those with a VPS or dedicated server since it requires access to the IIS manager and installing components which most shared hosting services will not provide. How to configure IIS as a reverse proxy is beyond the scope of this article but a search for "Configuring IIS as a reverse proxy" will provide many links such as

For those with shared hosting which will not allow IIS configuration, the options are limited. The web application itself must act as a reverse-proxy itself. By placing the reverse proxy logic in the application itself, the need to configure IIS is eliminated. While adding a reverse proxy to the application will work be aware that the hosting company may notice the proxied traffic and block the communication. It is not recommended to use the reverse proxy if you anticipate a lot of traffic, as it will most likely get you and others blocked.

An easy way to get reverse proxy functionality into an existing ASP.NET application is through the use of the open source project "Managed Fusion URL Rewrite and Reverse Proxy" ( As of writing, the project discussions are still hosted on codeplex (

To use this project, either download the source from github or the .dll ( from codeplex. If using source, add the ManagedFusion.Rewriter project to your existing ASP.NET application. If using the .dll, copy it somewhere (such as APP_DATA) into your project.

After installing the source or .dll, your main application will require a reference to it. If source was installed, add a reference to the ManagedFusion.Rewriter project. If the .dll was installed, add a reference to the MangedFusion.Rewriter.dll.

ManagedFusion.Rewriter should now be properly installed in the project. The remaining step is to add a file the holds the proxy rewrite rules. Add a file in the root project called "ManagedFusion.Rewriter.txt". Open the file and add a rewrite rule such as the following:

RewriteEngine On
RewriteRule ^/http-bind/ [P]

The above rule will map posts to to the BOSH Server. If you are using Visual Studio and the development version of IIS, the rule must include the application path. So for example if the application is configured to run as http://localhost:30320/MyApplication the rewrite rules is as follows:

RewriteRule ^/MyApplication/http-bind/ [P]

To make the XMPP weblient call the proxy, it needs to be configured to post to http-bind/. For most web clients this is the default URL.

It should be noted that as of writing, ManagedFusion.Rewriter (3.6) appears to have a bug in its logger. Do not enable logging unless you have the source and can fix the bug.

doc/setting_up_bosh/ · Last modified: 2013/08/19 16:30 by Matthew Wild