[Mongrel] Multiple rails apps with Mongrel

zer0halo
2006-09-08T14:57:46Z

On 9/7/06, Alexander Kabanov <shurikk at gmail.com>
wrote:
>
>
> 1. in config/routes.rb insert line
> ActionController::AbstractRequest.relative_url_root = "/app1"
>
> 2. create a symlink in app1 "public": ln -s . app1
>
> 3. start mongrel or webrick
> ruby script/server OR
> mongrel_rails start -p 3000
>
> 4.  connect directly to the server (without proxy) and test your
> application
> http://domain:3000/app1/
>
> I''m 100% sure it will work
>
>
Thanks, Alex. I tried the above and it does work. If I point to
http://domain:3000/app1, my  app works perfectly.

However, when I turn on the ProxyPass in Apache to port 80, and then point
to
http://domain/app1

The app goes into an endless loop.

Checking the logs, my app is initially correctly being routed to my default
controller and method (ie: http://domain/app1/items/index). However when
method ''items'' redirects to method
''view_list'', the application routes to:
http://domain/items/view_list

So basically it''s not applying the /app1 prefix to all redirects.

Here''s a log excerpt when I access my app1 home page (just relevent
lines):

Processing ItemsController#index (for 172.27.6.134 at 2006-09-08 09:55:10)
[GET]
  Parameters: {"action"=>"index",
"controller"=>"items"}
<snip>
Redirected to http://domain/app1/items/view_list
Completed in 0.03146 (31 reqs/sec) | DB: 0.00549 (17%) | 302 Found [
http://domain/items/view_list]

As you can see, the last line is the problem - no app1

So it seems I''m still missing a step.

My settings in my apache conf are simple:

<VirtualHost *>
        DocumentRoot /var/www
   # the usual other settings <snip>

    ProxyPass /app1 http://localhost:3000
    ProxyPassReverse /app1 http://localhost:3000
    ProxyPreserveHost on

</VirtualHost>

What am I still missing?

--
"Impossible is nothing."
-------------- next part --------------
An HTML attachment was scrubbed...