[LRUG] [OT:Apache] Mapping multiple domains to different controllers?

Matthew Rudy Jacobs matthewrudyjacobs at gmail.com
Mon Apr 13 16:50:54 PDT 2009


Hey,
I know this isn't ruby,
but I can't work this out.

It's kind of the opposite to the old "http://mydomain/app1" and
"http://mydomain/app2" pointing to two different applications.

What I want is "http://domain1" and "http://domain2"  to point to the
same rails app, but transparently rewritten to /domain1 and /domain2

And I was hoping there might be an apache guru looking for a way of
wasting time.

Boiling it down;

I have an app that lives at; ~/myapp
it has a public directory at: ~/myapp/public

This runs happily on MyDomain.com

I have a controller OtherDomainController
with the path /other_domain
and the static directory ~/myapp/public/other_domain

I want to setup a VHost for SomethingElse.com,
so that;

1. A request to "http://SomethingElse.com" should return the same
content as one to "http://MyDomain.com/other_domain"
2. It should achieve this without redirecting
3. It should serve ~/myapp/public/other_domain/index.htm to requests
for "http://SomethingElse.com/" if it is present

I have a gist - http://gist.github.com/94828
with a couple of things I've tried...

but I'm stumped.

Doing a normal redirect is fine,
but I don't want to issue a 302, I just want apache to deal with the
redirect internally (and [P] seems to break)
and I can't seem to make ModProxy work for me.

Any ideas as to where I'm going wrong?
Maybe its ModAlias I should be using.

I've thought of ways of doing it with a rack pre-processor,
but surely apache eats this stuff for brunch?



More information about the Chat mailing list