Question

I would like to publish my application to a selected set of individuals for a private beta. I created a sub-domain for this task: beta.company.com.

The application operates as expected on my workstation, but when I push it to the server, the application continually routes back to the authentication page. FYI, I'm using declarative-authorization, authlogic, and Passenger.

routes.rb:

  #Application controller
  match "/not_authorized", :to => "application#not_authorized", :as => :not_authorized

  #UserSessions controller
  match "/quit", :to => "user_sessions#destroy", :as => :quit
  match "/authenticate", :to => "user_sessions#new", :as => :authenticate
  resources :user_sessions, :only => :create

  #Users controller
  match "/enroll", :to => "users#new", :as => :enroll

  # root url
  root :to => "users#index"

Symptoms:

  • anonymous routes (e.g. user_sessions#create, not_authorized) work as expected for anon. user
  • the application operates as expected on my workstation

When I look at the production.log, I see an entry like:

Processing by UsersController#index as HTML Permission denied: No matching rules found for index for # @role_symbols=[:guest]> (roles [:guest], privileges [:index, :read, :manage], context :users). Redirected to http://beta.company.com/authenticate

** edit **

For one, there isn't a UsersController#index action, and if there was, the anonymous user wouldn't have access to it. I'm confused to why it is trying to route there at all (instead of the root url, which is where it should go after a successful authentication).

This seems like a sub-domain-specific routing issue, but I can't be sure.

re-read this 'error' more closely. there is a UserController#index action AND the anonymous user should NOT have access to it. at first glance, i thought it read UserSessionController#index, which is the action that doesn't exist.

now, it seems like the authenticated user isn't being created or saved and consequently, is being re-routed back to UserSession#new action (AKA authenticate path).

** / edit **

** edit II **

I changed from cookie_store to active_record_store:

# cookie store
# MyApp::Application.config.session_store :cookie_store, :key => '_myApp_session'
# active-record store
MyApp::Application.config.session_store :active_record_store

Added the table ($ rake db:sessions:create), did the migration ($ rake db:migrate), restarted Apache ($ touch tmp/restart.txt), cleared the browser's cache, then restarted the browser.

The session was added to the sessions table successfully, but I still get the problem.

** / edit II **

Thoughts are greatly appreciated.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top