multiple domains for the one app

hi all, (not sure which is the official list anymore!)

i have a cms that i am using for about 6 domains at the moment. i currently use svn to check out an 'instance' of each cms for a client and then modify a few global particular settings. each instance references its own database per client but in addition it accesses a global database that contains settings (such as if this client has access to shop functions etc).

what i would like to do is use only one 'instance' of the cms and one database for all clients. i have given it some thought and these are the pros and cons:

pros:

+ all clients get upgraded together + can release easily with capistrano to one location + don't have separate rails processes running, can just have one cluster to control

cons:

- need to grab (and parse, for www.* and alternatives) the HTTP host header to use as a key for all transactions - issues with multiple domains and sending emails (envelope-from addresses) - an error with the application will effect all clients - (more i can't think of)

there are examples for doing this for sub domains but not for tlds. i think the first 'con' above is going to be the main performance killer but i would like to know if others think this is a silly idea or if it is feasible.

any ideas and suggestions would be great.

-felix

this be be of some help: http://agilewebdevelopment.com/plugins/account_location

also, instead of parsing, try ActionController#subdomains:

Returns all the subdomains as an array, so ["dev", "www"] would be returned for "dev.www.rubyonrails.org". You can specify a different tld_length, such as 2 to catch ["www"] instead of ["www", "rubyonrails"] in "www.rubyonrails.co.uk".

ed