Export to GitHub

phusion-passenger - issue #169

RailsBaseURI doesn't work with Rails 2.2.2


Posted on Dec 6, 2008 by Swift Camel

RailsBaseURI doesn't appear to work with Rails 2.2.2 to deploy Rails sites in a subdirectory. Two forum posts - http://groups.google.com/group/phusion-passenger/browse_thread/thread/d3e7b1f524f5ab62 and http://groups.google.com/group/phusion-passenger/browse_thread/thread/bc1c7e99701ab5db - confirm this is a problem, and give a work around (config.action_controller.relative_url_root in environment.rb).

I wasn't sure if this had been reported, so thought it best to flag up here so that it could be fixed.

My system specs are included below:

Fedora 9, Ruby 1.8.6, RubyGems 1.3.1 (updated from dist 1.2.0 using update_gems), Rails 2.2.2

Comment #1

Posted on Dec 7, 2008 by Happy Wombat

I have also experienced same problem on CentOS 5.2, Ruby 1.8.6-p287, RubyGems 1.3.1, and rails 2.2.2. Though my rails app works well with setting ENV['RAILS_RELATIVE_URL_ROOT'], it's very inconvenient :(.

Comment #2

Posted on Jan 12, 2009 by Helpful Panda

It seems like this is probably related to this change in rails:

http://github.com/rails/rails/commit/a87462afcb6c642e59bfcd2e11e3351e2b718c38

According to the changelog, this went in in Rails 2.2.0.

Comment #3

Posted on Jan 17, 2009 by Happy Bird

Glad somebody caught this. I was beating my head into the wall with several apps not behaving. HOpe this gets fixed soon.

Comment #4

Posted on Feb 8, 2009 by Quick Bear

I also experienced this error and spent the entire day searching the web before I finally found the fix on a blog entry somewhere. Finally got it working, but it surely tripped me up for quite the long while. Thank you to all the people who DID discover a workaround/fix for the time being for posting what you found so that I could eventually find it. ;)

Comment #5

Posted on Feb 11, 2009 by Happy Ox

I'm experiencing this issue as well. Thank goodness it came up early in my searching.

Comment #6

Posted on Feb 11, 2009 by Happy Elephant

Now that I've been using it, in some ways I like the fact that Rails 2.2.2 requires you to specify the prefix path for the application, because it also uses that to calculate the asset tag URLs. I'd hate for Phusion to fix the RailsBaseURI issue, but then still have all the asset tags reporting the wrong URLs.

Comment #7

Posted on Feb 12, 2009 by Helpful Ox

@m3moore: That's not how it used to work. Rails would read the RAILS_RELATIVE_URL_ROOT environment variable, and ensure that your asset tag URLs were prefixed by the relative URL. Now you need to configure the relative URL twice; once in Rails and once in Passenger. That's the only difference.

Comment #8

Posted on Feb 12, 2009 by Helpful Ox

I have filed a ticket in LH, to find out the reason for the change and/or whether it can be fixed on the Rails end of things:

http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1946-setting-a-relative-root-url-via-a- web-server-not-possible-anymore

Comment #9

Posted on Apr 28, 2009 by Helpful Horse

I hit this issue trying to install typo. Glad there is a workaround, but I wish the workaround was listed in the passenger documentation under sub-uri documentation http://www.modrails.com/documentation/Users%20guide.html#deploying_rails_to_sub_uri

Comment #10

Posted on May 23, 2009 by Massive Wombat

They closed the ticket at https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1946-setting-a-relative-root-url-via-a- because they consider it's a passenger issue.

Comment #11

Posted on May 26, 2009 by Grumpy Camel

Fixed in commit 5eb8c84.

Status: Fixed

Labels:
Type-Defect Priority-Medium Milestone-2.2.3