# More virtual hosts on one rails application

**URL:** <https://www.ruby-forum.com/t/more-virtual-hosts-on-one-rails-application/181593>\
**Category:** Rails\
**Created:** [January 14, 2010, 9:49am UTC](https://www.ruby-forum.com/t/more-virtual-hosts-on-one-rails-application/181593 "2010-01-14T09:49:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fifigyuri](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@Fifigyuri](https://www.ruby-forum.com/u/Fifigyuri)\
**Post date:** [January 14, 2010, 9:49am UTC](https://www.ruby-forum.com/t/more-virtual-hosts-on-one-rails-application/181593/1 "2010-01-14T09:49:28Z")

</div>

How can I access one rails application through more virtual hosts. The  
different virtual hosts would differ in the database, images,  
stylesheets and in some cases the layout of the views. What do you  
recommend for realisation of serving multiple applications by one  
rails code, which is accessed through different virtual hosts?

Ideally I’d like to:  
\* I prefer rails to distinguish which db/styles/images/layouts  
have to use based on the host name.  
\* There may be different rails applications running, but above the  
same code.  
\* Db connections might be established during the application  
initiation.

I am wondering which layer the rails app should recognise the host?  
Should it be on the middleware, in boot scripts or elsewhere?

Thanks for your help,

```
 Georg
```
