Project

General

Profile

Actions

Defect #11881

closed

FCGI mode does not support sub-URI

Added by Jonathan Tee over 11 years ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Project settings
Target version:
-
Start date:
Due date:
% Done:

90%

Estimated time:
Resolution:
Wont fix
Affected version:

Description

Hi,
i installed redmine in a subdir /redmine.

My Setup: Redhat5,apache with fcgid

Every links in Redmine are generated correct, e.g. /redmine/projects/bal and so on. But if i go to my projectssettings (/redmine/projects/myproject/settings) some links are not generated correctly.

Tab Members, if i try to change the role -> 404 (The requested URL /memberships/8 was not found on this server. (/redmine/ is missing)

Tab Repositries
edit/del/user-links for an existing repro are not working, same like above:

<a href="/repositories/7/committers" class="icon icon-user">User</a>
<a href="/repositories/7/edit" class="icon icon-edit">Edit</a>
<a href="/repositories/7" class="icon icon-del" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Delete</a>

my Config:
environment.rb:Redmine::Utils::relative_url_root = "/redmine"
environment.rb:ActionController::Base.relative_url_root = "/redmine"

routes.rb (had to add scope and end):
RedmineApp::Application.routes.draw do
scope "/redmine" do
....

end


Related issues

Related to Redmine - Defect #11274: Repository edit link is incorrect when running in a sub-URIClosed

Actions
Related to Redmine - Defect #11886: Broken link while edit/delete "Issue Category" under project in Redmine 2.1.0New

Actions
Related to Redmine - Defect #12102: Installed Redmine in a sub-URI: Links are generated not correctlyNew

Actions
Related to Redmine - Defect #12420: URLs in notification emails do not include the sub-URIClosed

Actions
Actions #1

Updated by Jonathan Tee over 11 years ago

Environment:
Redmine version 2.1.0.stable
Ruby version 1.8.7 (x86_64-linux)
Rails version 3.2.8
Environment production
Database adapter MySQL

Actions #2

Updated by Jean-Philippe Lang over 11 years ago

  • Status changed from Resolved to New
Actions #4

Updated by Jonathan Tee over 11 years ago

a half duplicate #11274

Actions #5

Updated by Etienne Massip over 11 years ago

What's your Apache/.htaccess Redmine specific configuration looks like?

If you don't have any URL rewriting directive, i.e. Rails is handling application routes and assets URLs generation alone, then you could try to:

  • remove your changes in both environment.rb and routes.rb
  • add this single line in environment.rb right before the call to RedmineApp::Application.initialize!:
    RedmineApp::Application.routes.default_scope = '/redmine'
    
Actions #6

Updated by Jonathan Tee over 11 years ago

hi,
my .htaccess looks like

#diff htaccess.fcgi.example .htaccess
32a33

RewriteBase /redmine

i changed my config to your suggestion. Now css and js-links are also wrong: /css/.. and /js/... instead of /redmine/css.

everythings else is working, but not the repository-settings. Same error as above.

My apache conf for redmine:

#redmine
Alias /redmine /var/opt/apache/myvirthost/redmine/public/

Actions #7

Updated by Etienne Massip over 11 years ago

Jonathan Tee wrote:

i changed my config to your suggestion. Now css and js-links are also wrong: /css/.. and /js/... instead of /redmine/css.

My bad, you should keep the Redmine::Utils::relative_url_root = '/redmine' in environment.rb after the call to initialize!.

everythings else is working, but not the repository-settings. Same error as above.

It works fine for me and links are correctly generated, could that be a plugin issue?

Actions #8

Updated by Jonathan Tee over 11 years ago

Etienne Massip wrote:

My bad, you should keep the Redmine::Utils::relative_url_root = '/redmine' in environment.rb after the call to initialize!.

ok, added again. Now css and js-url works fine.

It works fine for me and links are correctly generated, could that be a plugin issue?

i removed all plugins, but same error.

What i don't understand when i look into the view _repositories.html.erb is how the urls are generated:

committers_repository_path(repository)
edit_repository_path(repository)
repository_path(repository)

doesn't work, but
new_project_repository_path(Herve Harster)
works

are these functions? if yes where can i find the definition?

Actions #9

Updated by Etienne Massip over 11 years ago

Jonathan Tee wrote:

are these functions? if yes where can i find the definition?

They are convenience methods automatically created by Rails from the routes definition.

As you set the scope for routes, I don't get why these specific ones wouldn't be treated like the others.

What gives you rake routes RAILS_ENV=production?

What about running (in production mode) with Webrick (you need to comment out the Redmine::Utils::relative_url_root = '/redmine' to test it)?

Actions #10

Updated by Abdul Halim Mat Ali over 11 years ago

I have run Redmine in multiple sub-URI and have no issues with it.

Maybe somebody should update http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI
or any related wiki on sub-URI.

You don't need to set Redmine::Utils::relative_url_root = "/redmine".

Below are the steps if you using apache assuming /var/www is your root directory and you have untar your Redmine
to /opt/redmine.
BTW, I am using Apache with Passenger.

  • Create the symbolic link
    ln -s /opt/redmine/public /var/www/redmine
    
  • in /etc/httpd/conf.d/redmine.conf
     <Location /redmine>
        RailsEnv production
        RailsBaseURI /redmine
        PassengerResolveSymlinksInDocumentRoot on
      </Location>
    
Actions #11

Updated by Etienne Massip over 11 years ago

Abdul Halim Mat Ali wrote:

I have run Redmine in multiple sub-URI and have no issues with it.

Abdul, just to make sure, are you using Redmine 2.x?

Actions #12

Updated by Abdul Halim Mat Ali over 11 years ago

Yes. 2.1.0.

BTW, call me Halim.

and I have edited the symbolic link to

ln -s /opt/redmine/public /var/www/redmine

Actions #13

Updated by Jonathan Tee over 11 years ago

Etienne Massip wrote:

What gives you rake routes RAILS_ENV=production?

interesting...
all entries have a /redmine-prefix except

membership GET      /memberships/:id(.:format)                                                                members#show
PUT /memberships/:id(.:format) members#update
DELETE /memberships/:id(.:format) members#destroy
edit_issue_category GET /issue_categories/:id/edit(.:format) issue_categories#edit
issue_category GET /issue_categories/:id(.:format) issue_categories#show
PUT /issue_categories/:id(.:format) issue_categories#update
DELETE /issue_categories/:id(.:format) issue_categories#destroy
committers_repository GET|POST /repositories/:id/committers(.:format) repositories#committers
edit_repository GET /repositories/:id/edit(.:format) repositories#edit
repository PUT /repositories/:id(.:format) repositories#update
DELETE /repositories/:id(.:format) repositories#destroy
relation GET /relations/:id(.:format) issue_relations#show
DELETE /relations/:id(.:format) issue_relations#destroy

if i look into routes.rb, all these entries have ":shallow => true"

Actions #14

Updated by Etienne Massip over 11 years ago

You can try:

RedmineApp::Application.routes.default_scope = { :path => '/redmine', :shallow_path => '/redmine' }

But that shallow_path should already be inherited from path.

Are you sure you didn't change any other configuration setting somewhere?

Actions #15

Updated by Jonathan Tee over 11 years ago

  • % Done changed from 0 to 90

thanks, you did it. Now it works :-)

now my environment.rb looks like:

...
RedmineApp::Application.routes.default_scope = { :path => '/redmine', :shallow_path => '/redmine' }

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

I've checked all my configs again but i'm quite sure i did not change other settings. But i know that i didn't changed any core files. Just the files in the config dir.

Actions #16

Updated by Dmitry Vorobiev over 11 years ago

Jonathan Tee wrote:

thanks, you did it. Now it works :-)

now my environment.rb looks like:
[...]

I've checked all my configs again but i'm quite sure i did not change other settings. But i know that i didn't changed any core files. Just the files in the config dir.

Jonathan,
I have probably similar problem (#12102), unfortunately advice with RedmineApp::Application.routes.default_scope don't help fix it.

Actions #17

Updated by Etienne Massip over 11 years ago

  • Subject changed from Installed Redmine in a sub-URI: Links are generated not correctly in Settings ->Error 404 to FCGI mode does not support sub-URI
  • Status changed from New to Confirmed

source:/tags/2.1.2/public/dispatch.fcgi.example should set env['SCRIPT_NAME'] to the value of Redmine::Utils::relative_url_root.

Actions #18

Updated by Etienne Massip over 11 years ago

  • Target version set to Candidate for next minor release
Actions #19

Updated by Etienne Massip over 11 years ago

  • Priority changed from High to Normal
Actions #20

Updated by Bill Levering about 11 years ago

Note: I tried posting this to: http://www.redmine.org/boards/2/topics/30676?r=30881
where it seems it would be most useful, but I always get 'posting denied as spam'

Working Redmine subdir/nginx:

  • Redmine 2.2.0 (fresh install)
  • no plugins
  • ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
  • rails (3.2.9)
  • passenger (3.0.18)
  • nginx version: nginx/1.2.4

as per:
[[http://www.redmine.org/issues/11881#note-14]]

config/environment.rb:

RedmineApp::Application.routes.default_scope = { :path => '/redmine', :shallow_path => '/redmine' }
RedmineApp::Application.initialize!
Redmine::Utils::relative_url_root = '/redmine'

nginx.conf: (mostly unchanged)

http {

    passenger_root /usr/local/rvm/gems/ruby-1.9.3-p327/gems/passenger-3.0.18;
    passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3-p327/ruby;

    server {
        listen       80;
        server_name  localhost;

        location /redmine {
            root /usr/local/redmine/public;
            passenger_enabled on;
        }
    }
}


THEN, create soft link in the public directory:
cd redmine/public
ln -s . redmine

Actions #21

Updated by Den Iskandarov about 11 years ago

no chance to get this fixed in next major or minor release :( ?

Actions #22

Updated by Go MAEDA about 2 months ago

  • Status changed from Confirmed to Closed
  • Target version deleted (Candidate for next minor release)
  • Resolution set to Wont fix

I am closing this issue because FastCGI support will be removed in the upcoming Redmine 6.0.0 (#40092).

Actions

Also available in: Atom PDF