Project

General

Profile

Actions

Defect #11147

open

relative_url_root changes only css... , but not dynamic pages

Added by Achim Gaedke over 12 years ago. Updated almost 12 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Rails support
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

I try to follow the instructions at http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI and have a local redmine installation serving at port 3000 with a URL prefix /redmine2. Later on I want to proxy this server via apache to /redmine2 on port 80.

Setting the relative_url_root to /redmine2 results in a "Redmine 404 error" page for the URL: http://localhost:3000/redmine2/ (Browser Cache is disabled).

Calling http://localhost:3000/ results in a "correct" page without layout... looking at the source:
All of the java script, atom and css links seem to be prefixed correctly with /redmine2, but not found there.

Sadly the redmine pages related links (like /projects, /my/page or /admin) are not prefixed.

I don't know how to make use of this behaviour. So I feel a bit "lost" (as promised in the opening paragraph of the HowTo).

This is the config/environment.rb file

# Load the rails application
require File.expand_path('../application', __FILE__)

# Make sure there's no plugin in vendor/plugin before starting
vendor_plugins_dir = File.join(Rails.root, "vendor", "plugins")
if Dir.glob(File.join(vendor_plugins_dir, "*")).any?
  $stderr.puts "Plugins in vendor/plugins (#{vendor_plugins_dir}) are no longer allowed. " +
    "Please, put your Redmine plugins in the `plugins` directory at the root of your " +
    "Redmine directory (#{File.join(Rails.root, "plugins")})" 
  exit 1
end

# Initialize the rails application
RedmineApp::Application.initialize!
Redmine::Utils::relative_url_root = "/redmine2" 

restarting with mongrel:

#> ruby redmine-2.0/script/rails server mongrel -d -e production -p 3000
=> Booting Mongrel
=> Rails 3.2.5 application starting in production on http://0.0.0.0:3000

Some version infos (as provided on the Admin->Information page)

Environment:
  Redmine version                          2.0.2.stable.9774
  Ruby version                             1.8.7 (x86_64-linux)
  Rails version                            3.2.5
  Environment                              production
  Database adapter                         MySQL
Redmine plugins:
  no plugin installed


Files

Redmine.html (4.2 KB) Redmine.html Redmine page Ray Merkert, 2012-12-20 18:20

Related issues

Related to Redmine - Defect #11058: Run Redmine in a sub directory results in "No route matches"New

Actions
Related to Redmine - Defect #17309: RSS feed gives away localhost linkClosed

Actions
Actions #1

Updated by Ray Merkert almost 12 years ago

Is anyone looking at this issue?
I've just updated to the latest redmine (via git) and I'm seeing the exact same problem. This is definitely a regression, as it was working fine for me before (rails 2 I guess). I've attached the html that gets generated and shows correct links for CSS/Javascript and incorrect links for basically everything else (some things even reference localhost!)

I've tried several of those "fixes" that are floating around (not sure why there are some many different ways of controlling this seemingly simple parameter) and none of them work.

FYI: I'm running redmine like this (as per instructions at http://www.redmine.org/projects/redmine/wiki/RedmineInstall):
ruby script/rails server webrick -e production
and that has always worked for me.

I'm also using this entry in additional_environment.rb: config.action_controller.relative_url_root = "/redmine"

After updating the routes.rb with scope "/redmine" do and fixing up my apache forwarding file, it's at least emitting all the right URLs, except it's no longer able to find the CSS files under the /redmine path prefix.

Looks like this is RAILS3 bug after doing some more research.

Actions #2

Updated by Etienne Massip almost 12 years ago

This has been discussed in #11881.

You have to both add Redmine::Utils::relative_url_root = "/redmine" in environment.rb and the scope in routes.rb (or RedmineApp::Application.routes.default_scope = '/redmine' before the call to RedmineApp::Application.initialize! in environment.rb).

Actions #3

Updated by Ray Merkert almost 12 years ago

Doesn't work.

Now I'm getting: ActionController::RoutingError (No route matches [GET] "/redmine/javascripts/application.js").

It also generates RSS feeds like this (note the hostname!):
<link href="http://localhost:3000/redmine/activity.atom" rel="alternate" title="Redmine: Activity" type="application/atom+xml" />

Actions #4

Updated by Toshi MARUYAMA over 10 years ago

  • Related to Defect #17309: RSS feed gives away localhost link added
Actions

Also available in: Atom PDF