I am curious as to how, for example Beanstalk and Server Density, create custom domains (e.g. custom.beanstalkapp.com, custom.serverdensity.com) for each sign-up. I would like to do something similar so that clients and their staff access the web-app at their own sub-domain. Each app either uses LDAP or our own native user storage depending on client choice and would share a common API.
Does each custom domain share the same web app code base?
Taking this further what if I wanted to allow a completely custom domain as you can get with bit.ly pro. I'd imagine in this case the customer would point the A record for their domain to our web servers and then we would have to programatically edit our Apache configuration to add a new virtual host for that domain?
In this application the API is written in Java (using Restlet) with the front-end written in GWT. The data layer is built in MongoDB.
You want a web server where you can programatically change the configuration notably for the virtual hosts.
This will most likely mean that you will want an embeddable server to have full control of what goes on instead of hacking on a stand-alone server. That is the first step. Do that first.