routing - Rails 3 subdomain -
i publish application selected set of individuals private beta. created sub-domain task: beta.company.com.
the application operates expected on workstation, when push server, application continually routes authentication page. fyi, i'm using declarative-authorization, authlogic, , 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 expected anon. user
- the application operates expected on workstation
when @ production.log, see entry like:
processing userscontroller#index html permission denied: no matching rules found index # @role_symbols=[:guest]> (roles [:guest], privileges [:index, :read, :manage], context :users). redirected http://beta.company.com/authenticate
** edit **
for one, there isn't userscontroller#index action, , if there was, anonymous user wouldn't have access it. i'm confused why trying route there @ (instead of root url, should go after successful authentication).
this seems sub-domain-specific routing issue, can't sure.
re-read 'error' more closely. there usercontroller#index action , anonymous user should not have access it. @ first glance, thought read usersessioncontroller#index, action doesn't exist.
now, seems authenticated user isn't being created or saved , consequently, being re-routed usersession#new action (aka authenticate path).
** / edit **
** edit ii **
i changed cookie_store 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 table ($ rake db:sessions:create), did migration ($ rake db:migrate), restarted apache ($ touch tmp/restart.txt), cleared browser's cache, restarted browser.
the session added sessions table successfully, still problem.
** / edit ii **
thoughts appreciated.
for starters…
for one, there isn't userscontroller#index action, , if there was, anonymous user wouldn't have access it. i'm confused why trying route there @ (instead of root url, should go after successful authentication).
your root url userscontroller#index:
# root url root :to => "users#index"
check make sure setting cookie on beta domain. might redirecting or setting links use full url (rather path, user_url(@user)
vs user_path(@user)
), cause headed straight root domain.
Comments
Post a Comment