Redmine 2.0 "No route matches"

Added by Moritz Herrmann over 5 years ago

Hi,

I'm trying to migrate to redmine 2.0 on a fcgi base

RAILS_ENV=production script/about
Environment:
  Redmine version                          2.0.0.stable.9700
  Ruby version                             1.8.7 (x86_64-linux)
  Rails version                            3.2.3
  Environment                              production
  Database adapter                         MySQL
Redmine plugins:
  no plugin installed
 cat /etc/apache2/sites-enabled/000-default
<VirtualHost *:443>
        ServerAdmin webmaster@localhost

    SSLEngine on
    SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
    #SSLCertificateChainFile /etc/apache2/ssl/sub.class1.server.ca.pem
    #SSLCACertificateFile /etc/apache2/ssl/ca.pem

    DocumentRoot /var/www/

    # redmine
    Alias /redmine /srv/redmine/public
    <Directory /srv/redmine/public>
        AllowOverride All
        Order allow,deny
        allow from all
        SSLRequireSSL
    </Directory>
</VirtualHost>
 cat public/.htaccess
# General Apache options
Options FollowSymLinks ExecCGI

RewriteEngine On

RewriteBase   /redmine

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly" 

Now I'll get this error:

ActionController::RoutingError (No route matches [GET] "/redmine/index.html"):
  actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call'
  rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
  rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
  rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
  rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
  rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
  railties (3.2.3) lib/rails/engine.rb:479:in `call'
  railties (3.2.3) lib/rails/application.rb:220:in `call'
  railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `send'
  railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
  public/dispatch.fcgi:16:in `call'
  rack (1.4.1) lib/rack/handler/fastcgi.rb:66:in `serve'
  rack (1.4.1) lib/rack/handler/fastcgi.rb:28:in `run'
  rack (1.4.1) lib/rack/handler/fastcgi.rb:27:in `each'
  rack (1.4.1) lib/rack/handler/fastcgi.rb:27:in `run'
  public/dispatch.fcgi:20

If I change the DocumentRoot to /srv/redmine/public all goes well but since this is not a standalone redmine machine and there will be other webs on this server redmine needs to run in a subdirectory.

I tried all kinds of Subdirectory URI but none worked for me

Redmine::Utils::relative_url_root = "/redmine" 
ActionController::Base.relative_url_root = "/redmine" 

config.action_controller.relative_url_root = "/redmine" # in enviroments/production*

Have anybody an Idea?

This setup worked for redmine 1.4*

thanks in advance

Replies (15)

RE: Redmine 2.0 "No route matches" - Added by Bastian Schern over 5 years ago

I have the same Problem! 1.4 is working fine and 2.0 is not working with the same errors above.
Does nobody else uses fcgi?

RE: Redmine 2.0 "No route matches" - Added by Etienne Massip over 5 years ago

Did you update your dispatch.fcgi according to the new dispatch.fcgi.example?

RE: Redmine 2.0 "No route matches" - Added by Xue Shuiliang over 5 years ago

Env: Lighttpd 1.4.30 + Redmine 2.0 + lua

RE: Redmine 2.0 "No route matches" - Added by Xue Shuiliang over 5 years ago

i don't update. it is a new install

RE: Redmine 2.0 "No route matches" - Added by Moritz Herrmann over 5 years ago

I've gone from update to complete reinstall(includeing the server). Issue still there -.-

RE: Redmine 2.0 "No route matches" - Added by Dirk Brammertz over 5 years ago

Since rails 3 the ActionController works different. As a dirty hack I modified the config/routes.rb to add my new root context "/redmine":

--- redmine-2.0.0/config/routes.rb    (revision 9726)
+++ redmine-2.0.0/config/routes.rb    (working copy)
@@ -16,6 +16,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

 RedmineApp::Application.routes.draw do
+scope "/redmine" do
   root :to => 'welcome#index', :as => 'home'

   match 'login', :to => 'account#login', :as => 'signin'
@@ -332,3 +333,4 @@
     end
   end
 end
+end

And as last line in the config/environment.rb

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

Give it a try, for me it worked.

RE: Redmine 2.0 "No route matches" - Added by Xue Shuiliang over 5 years ago

thanks...
it's working.

RE: Redmine 2.0 "No route matches" - Added by Jan T. over 5 years ago

Hi all,

so it is a Redmine 2.x bug or is Redmine not supposed to run in a sub directory (http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI)?

RE: Redmine 2.0 "No route matches" - Added by Dirk Brammertz over 5 years ago

In my opinion it is a bug. The docu says that it works within a sub directory. Since redmine 1.4 with rails 2 it worked, with redmine 2.x and rails 3 the feature is broken.

Bug report create: http://www.redmine.org/issues/11058

RE: Redmine 2.0 "No route matches" - Added by Jan T. over 5 years ago

Great - I didnt saw your entry and filed another one (#11059) :\.
I commented mine as a duplicate ;)

RE: Redmine 2.0 "No route matches" - Added by Xue Shuiliang about 5 years ago

update 4 shallow route, if add scope in routes.rb.
append
, :shallow_path => 'redmine'

       match 'copy', :via => [:get, :post]
     end

    resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :create, :update, :destroy], :shallow_path => 'redmine' do
       collection do
         get 'autocomplete'
       end
...
       get 'report', :on => :collection
     end
     resources :queries, :only => [:new, :create]
    resources :issue_categories, :shallow => true, :shallow_path => 'redmine'
     resources :documents, :except => [:show, :edit, :update, :destroy]
     resources :boards
    resources :repositories, :shallow => true, :except => [:index, :show], :shallow_path => 'redmine' do
       member do
         match 'committers', :via => [:get, :post]
       end
...
         get 'report'
       end
     end
    resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy], :shallow_path => 'redmine'
   end
   match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete

RE: Redmine 2.0 "No route matches" - Added by Jost Baron over 4 years ago

Hi,

I've built a patch (base on r11840) to make redmine work in a subdirectory with WEBrick. I've used the ideas from this issue.

To use redmine in a sudirectory after applying this patch, you need to do two things:

  1. Edit config/routes.rb to set the subpath at the top of the file.
  2. Create a folder structure for the subpath in your public-directory, except for the last segment. So if your subpath is foo/bar/baz, create the folders foo and foo/bar. Then add a symlink into the deepest folder, pointing back to the public-directory and having the name of the last path segment as name. This symlink ensures that static files are served correctly.

This patch is far from perfect, especially the second part with the symlink needs improvement. If someone knows how to get around that, I'd be happy to add it to the patch.

Also, I did not test this with anything but WEBrick. So if you consider merging it, additional testing will be needed.

subdirectory.patch Magnifier (32.2 KB)

RE: Redmine 2.0 "No route matches" - Added by Yehuda Katz almost 4 years ago

This patch works for me in unicorn 4.6.3.

(1-15/15)