RailsBaseURI and relative_url_root

238 views
Skip to first unread message

ben.koski

unread,
Dec 5, 2008, 1:05:39 PM12/5/08
to Phusion Passenger Discussions
Does Passenger automatically set
ActionController::AbstractRequest.relative_url_root for rails
applications running under a RailsBaseURI directive?

I realized that in some applications, providing a "RailsBaseURI /
myapp" directive automatically sets the relative_url_root='/myapp'
without any sort of intervention in the app's environment.rb. In
other cases, this doesn't seem to work.

I grepped through the Passenger source and couldn't find any
references to relative_url_root or the RAILS_RELATIVE_URL_ROOT
environmental var. I also checked the ENV vars set in an app running
under a RailsBaseURI and it didn't sem to contain
RAILS_RELATIVE_URL_ROOT or SCRIPT_NAME.

Rhett Sutphin

unread,
Jan 12, 2009, 3:22:42 PM1/12/09
to Phusion Passenger Discussions
Hi,

This is a bit of a late reply.

On Dec 5 2008, 12:05 pm, "ben.koski" <ben.ko...@gmail.com> wrote:
> DoesPassengerautomatically set
> ActionController::AbstractRequest.relative_url_root for rails
> applications running under a RailsBaseURI directive?

It does for Rails 2.1 and earlier, sort of. Under Rails 2.1 and
earlier, you could set the relative_url_root via an HTTP header and
Passenger did this (or seemed to). Under Rails 2.2, support for the
HTTP header was removed for some reason. ( Rails commit:
http://github.com/rails/rails/commit/a87462afcb6c642e59bfcd2e11e3351e2b718c38
) There's an open issue for this now:

http://code.google.com/p/phusion-passenger/issues/detail?id=169

> I realized that in some applications, providing a "RailsBaseURI /
> myapp" directive automatically sets the relative_url_root='/myapp'
> without any sort of intervention in the app's environment.rb. In
> other cases, this doesn't seem to work.

It may be that the applications which work automatically are Rails 2.1
(or earlier) and the ones that don't are 2.2.

Rhett
Reply all
Reply to author
Forward
0 new messages