Defect #32412

Redmine::Utils::relative_url_root in in environment.rb does not redirect links

Added by Tuomas Huuki about 2 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:-
Resolution: Affected version:3.4.12

Description

As topic. When redmine is run with an relative url through apache, the relative_url_root does not redirect the links (Home, projects my_page etc.) Css and .js are redirected ok for some reason.

So, http://our_great.server:3000 works ok, but with http://our_great.server/redmine-qa, the links are broken.

Environment:

Environment:
  Redmine version                3.4.12.stable
  Ruby version                   2.4.6-p354 (2019-04-01) [x86_64-linux]
  Rails version                  4.2.11.1
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.9.7
  Git                            2.17.1
  Filesystem                     
Redmine plugins:
  redmine_tags                   3.2.2
  scrum                          0.18.0

Apache configuration:

PassengerRuby /usr/share/rvm/wrappers/ruby-2.4.6/ruby

<VirtualHost *:3300>
    ServerName our_great.server
    DocumentRoot /var/redmine_staging/public
    PassengerStickySessions on

    <Directory /var/redmine_staging/public>
        Allow from all
        Options -MultiViews
        Require all granted
    </Directory>                                                                                                                                                                              
</VirtualHost>

Proxy:

ProxyPass         /redmine-qa  http://localhost:3300 nocanon
ProxyPassReverse  /redmine-qa  http://localhost:3300
ProxyRequests     Off
AllowEncodedSlashes NoDecode
                                                                                                                                                                                              <Location /redmine-qa>
        Options +Indexes +ExecCGI +FollowSymLinks -MultiViews
        Order Allow,Deny
        Allow from all
</Location>

environment.rb

# 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
Rails.application.initialize!

Redmine::Utils::relative_url_root = "/redmine-qa" 

In addition, this wiki will need updating probably:
https://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_subdirectory_(sub-URI)_on_Apache

Also available in: Atom PDF