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.

For those with shared hosting which will not allow IIS configuration, the options are limited. The asp.net 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.

To use this project, either download the source from github or the .dll (http://urlrewriter.codeplex.com/releases/view/89403) 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 asp.net 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:

The above rule will map posts to http://www.example.com/http-bind 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: