RailsBaseURI not working with Rails 2.2.2 routes?

328 views
Skip to first unread message

HP

unread,
Nov 25, 2008, 12:21:15 PM11/25/08
to Phusion Passenger Discussions
Hi,

My rails-app runs in a subdirectory, it works without problems with
Rails 2.1.2. When I change the apps gem-version to 2.2.2, or try a new
app, I get routing-errors. No changes made to passengers configuration
file.

URL: www.example.com/<subdir>/<app-routes>

I get the following error using map.resource routes:

Routing Error
No route matches "/<subdir>/" with {:method=>:get}

When I switch gem-version back to 2.1.2 it works.

Is there a rails base_uri configuration I'm missing? Passenger
configuration? A Rails problem?

Best regards,
HP



Con

unread,
Nov 28, 2008, 9:30:55 PM11/28/08
to Phusion Passenger Discussions
Hi, when you upgraded from 2.1.2 to 2.2.2, did you perform the
following before using passenger:

a) gem install rails

b) upgrade RAILS_ENV to 2.2.2

c) rake rails:update

d) check the routes file for correctness

e) run your application locally using mongrel

Good luck,

-Conrad

HP

unread,
Nov 30, 2008, 2:41:57 PM11/30/08
to Phusion Passenger Discussions
Hi Conrad, thanks for the reply.

I have tested with both an upgraded 2.1.2 app, and a brand new 2.2.2
app. Same problem.

Deploying in a subdirectory using Mongrel works without problems. How-
to here: http://www.benlog.org/2007/2/17/deploy-your-rails-app-in-a-subdirectory-with-apache-and-mongrel

a) to e) is Ok.

I'm having the same problem using passenger both on production server
and localhost, RAILS_ENV production and development. Production server
is "Apache/2.2.8 (Ubuntu) Phusion_Passenger/2.0.3", localhost is OS-X
Lepoard with gem-installed passenger 2.0.3. Rails 2.2.2 on both.

I'm following "Phusion Passenger users guide":
http://www.modrails.com/documentation/Users%20guide.html#deploying_rails_to_sub_uri

Has anyone else tried deploying a 2.2.2-app in an SubURI?

Thanks,

- HP

dmack

unread,
Nov 30, 2008, 2:49:14 PM11/30/08
to Phusion Passenger Discussions
For what it's worth; I am seeing the same problem after I switched
from 2.1 to 2.2.2. I'm also using Passenger. Let me know if you
find a solution; I will do the same.

Dan

ngocdaothanh

unread,
Dec 1, 2008, 10:02:27 AM12/1/08
to Phusion Passenger Discussions
Same here.

1. The problem:

If the config is: RailsBaseURI /xxx
Then
* The request to http://server/xxx/yyy will seen in Rails as /xxx/yyy,
not /yyy
* The output of stylesheet_link_tag('application') is
http://server/stylesheets/application.css, not http://server/xxx/stylesheets/application.css

2. Solution
I don't know how to solve this problem, but changing to normal
deployment (removing RailsBaseURI) works.

Ngoc.

HP

unread,
Dec 1, 2008, 4:58:15 PM12/1/08
to Phusion Passenger Discussions
I get the same issue with passenger 2.0.4.

- HP

On Dec 1, 4:02 pm, ngocdaothanh <ngocdaoth...@gmail.com> wrote:
> Same here.
>
> 1. The problem:
>
> If the config is: RailsBaseURI /xxx
> Then
> * The request tohttp://server/xxx/yyywill seen in Rails as /xxx/yyy,
> not /yyy
> * The output of stylesheet_link_tag('application') ishttp://server/stylesheets/application.css, nothttp://server/xxx/stylesheets/application.css

HP

unread,
Dec 1, 2008, 5:06:56 PM12/1/08
to Phusion Passenger Discussions
It works with this solution:
http://groups.google.com/group/phusion-passenger/browse_thread/thread/bc1c7e99701ab5db
3rd post.

Add:

config.action_controller.relative_url_root = "/<sub-uri>"

to enviroment.rb inside the "Rails::Initializer.run do |config|"
block.

Thank you, Pedz!

- HP

On Dec 1, 10:58 pm, HP <hanspet...@gmail.com> wrote:
> I get the same issue with passenger 2.0.4.
>
> - HP
>
> On Dec 1, 4:02 pm, ngocdaothanh <ngocdaoth...@gmail.com> wrote:
>
> > Same here.
>
> > 1. The problem:
>
> > If the config is: RailsBaseURI /xxx
> > Then
> > * The request tohttp://server/xxx/yyywillseen in Rails as /xxx/yyy,
Reply all
Reply to author
Forward
0 new messages