Multiple virtual hosts within sigle rails installation


#1

Hello,

I’m proting an in-house application to ruby and RoR. The application
was in development & production
for over 3 years. It’s about 50K LOC in php and python (using
twisted.python library). Porting from php to RoR is like a breath of
fresh air, and i have been able to ‘fake’ most of the twisted.python
features I use with ruby.

But I’m stuck with a stupid url mapping problem :frowning:
I need severeal 3rd level domains to map to different controller
namespaces.
adminstuff.mydomain.com/controller has to map to
Adminstuff::Controller in app/adminstuff/controller
customer.mydomain.com/controller has to map to Customer::Controller
in app/cuscomer/controller etc.

It is a single application - it shares all config files, all models,
all libraries. Only the controllers and domain names are different.

The rails url map feature doesn’t seem to support this kind of mapping.
I also tried to use url rewriting (with lighttpd) - looks like it
doesn’t work for rails pages - dispatch.fcgi always gets the full url
without rewriting. Url rewriting works with static files though.

Any suggestions how I can accomplish this wihtout patching rails
dispatch methods?

best regards,
Alex Zhukov
removed_email_address@domain.invalid