On Mon, 2006-07-10 at 12:38 -0700, Scott Laird wrote:
> I'm trying to make Mongrel the default web server for Typo, but I'm
> running into a problem.  Is there an easy way to run a Rails app in a
> subdirectory (http://foo/blog instead of http://foo/) with Mongrel?
> For most apps, I'd just change routes.rb to include the prefix that I
> wanted, but that won't really work with Typo--I'd rather not require a
> few hundred users to modify Typo's source code if I can avoid it.  I'd
> rather handle this via Mongrel. 
> 
Nope, you need to have Rails handle it.

> I tried changing the 'uri "/", :handler => rails(:mime => mime)' line
> in mongrel_rails (both directly and via a -S config script) and that
> doesn't quite do the job--the Rails app still thinks it's running in
> '/', so routes are broken.  Is there an easy way to handle this? 
> 

Nope that won't work since the HTML that rails generates would then have
all the wrong URIs.  You'd request /myappliveshere/users/dostuff, and
then all the links, redirects, everything would point to /users/dostuff.
You have to tell rails that it lives at /myappliveshere.

I could swear that there was a config option you can put in your
environment.rb which tells Rails it's at a different base URI.

> If not, would a patch that adds a --prefix command-line flag for
> mongrel_rails (along with a few lines of plumbing) be accepted?

Mongrel *can not* help you with this.  The problem is that in order for
you to put an app at a different URI base the app needs to rewrite all
URIs to include this base.  If you don't get rails to do it then the web
server has to do it and I flat out refuse to troll through html changing
links. :-)

I imagine previously that's what your apache config with fastcgi was
doing.  There just isn't any other way to do it outside of rails.  This
also means that your previous config was horribly inefficient.

Snoop around on the interwebs and google for this magic config.  I'm
pretty sure I'm not crazy, but it's something like:

config.action_controller.rails_root = "/myappliveshere"

Or maybe it was a routes.rb setting.

-- 
Zed A. Shaw
http://www.zedshaw.com/
http://mongrel.rubyforge.org/
http://www.railsmachine.com/ -- Need Mongrel support?

_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to