Defect #4777

Redmine no longer supports running in a sub-directory

Added by John Hogenmiller almost 12 years ago. Updated over 11 years ago.

Status:ClosedStart date:2010-02-09
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:UI
Target version:-
Resolution:Invalid Affected version:0.9.2

Description

Version Details:
  • Redmine 0.9.2 (not yet in Affected versions list)
  • Mysql 5.07
  • Ruby 1.8.7
  • Rails 2.3.5
  • Phusion Passenger 2.0.3

Issue:
I was running Redmine 0.8.4 under passenger in a subdirectory /projectdoc. After upgrading to Redmine 0.9.2, Redmine would produce a 404 page when accessing the application. If I ran the included server (script/server), the application works.

I added the line:

 ActionController::Base.relative_url_root = "/projectdoc"   

to the bottom of environment.rb, the application works, but images, stylesheets, and javascript files are referenced from the root directory. For example, instead of /projectdoc/javascripts/application.js, it calls /javascripts/applications.js.

Suggestion:
Templates should be modified so that they reference relative_url_root in generating links.

History

#1 Updated by John Hogenmiller almost 12 years ago

I was slightly incorrect.

Viewing the source, I see that it does generate the links correctly:

<link href="/projectdoc/stylesheets/application.css?1265547335" media="all" rel="stylesheet" type="text/css" />
<script src="/projectdoc/javascripts/prototype.js?1265547335" type="text/javascript"></script>
<script src="/projectdoc/javascripts/effects.js?1265547335" type="text/javascript"></script>
<script src="/projectdoc/javascripts/dragdrop.js?1265547335" type="text/javascript"></script>
<script src="/projectdoc/javascripts/controls.js?1265547335" type="text/javascript"></script>

<script src="/projectdoc/javascripts/application.js?1265547335" type="text/javascript"></script>
<link href="/projectdoc/stylesheets/jstoolbar.css?1265547335" media="screen" rel="stylesheet" type="text/css" />

The issue is that the assets are never served. If I go to "http://www.example.com/projectdoc/stylesheets/application.css" in the web browser, it attempts to match that as a route and fails.

ActionController::RoutingError (No route matches "/stylesheets/application.css" with {:method=>:get}):

As a test, I edited config/environments/production.rb and added the following:

   config.action_controller.asset_host = "https://www.example.com/pdc" 

And I added an Alias to my httpd configuration:
  RailsBaseURI /projectdoc
  Alias /pdc/projectdoc /usr/local/redmine/public

While not a documented feature of asset_host, this in fact worked. It is not an elegant solution, but it is a suitable workaround.

#2 Updated by Felix Schäfer over 11 years ago

  • Status changed from New to Closed
  • Affected version (unused) changed from 0.9.1 to 0.9.2
  • Resolution set to Invalid
  • Affected version changed from 0.9.1 to 0.9.2

I think the problem was an outdated passenger and/or misconfiguration of apache.

Also available in: Atom PDF