I want to serve 2 different domains on my rails application, let’s say
http://A.com and http://B.com
Is this possible? I use nginx and mongrel if is important.
There’s a partial solution here:
But be sure to read the following discussion. Jamis says:
“Youâ€™ll notice, if you actually try to use it, that route generate is a
little wonky now, unless you use named routes exclusively. Route
generation is hard to make work with the host/domain/subdomain thing,
because route generation has no access to the request. In fact, route
generation does not generate the host portion of the URL; it generates
only the path. Itâ€™s a hard problem.”
Having worked on this problem last week, I can attest that what he
speaks the truth:-)
Incoming requests work fine, but url_for (and anything that uses it)
will be broken for any routes that share the same “signature”, and
you’ll have to hack in something to handle that problem.