ruby on rails 3.2 - Devise redirecting to different resource when using force_ssl -


i have force_sslenabled entire application , using devise authentication. in production when try , access http devise-path e.g., http://domain.com/users/sign_in, redirected https version of path different resource e.g., https://domain.com/admins/sign_in.

this seems dependent on order resources given in routes.rb. instance if have:

devise_for :users devise_for :admins 

then accessing http://domain.com/admins/sign_inwill redirect https://domain.com/users/sign_in, whereas http://domain.com/users/sign_inwill maintain correct resource , redirect https://domain.com/users/sign_in.

if change order of resources in routes.rb, opposite true.

i have implemented customized version of force_sslin application controller in order able later specify controller actions exceptions.

class applicationcontroller < actioncontroller::base include applicationhelper protect_from_forgery  #re-implement force_ssl allow override in controllers def self.force_ssl(options = {})  host = options.delete(:host)  before_filter(options)   if !request.ssl? && !rails.env.development? && !(respond_to?(:allow_http?) && allow_http?)     redirect_options = {:protocol => 'https://', :status => :moved_permanently}     redirect_options.merge!(:host => host) if host     redirect_options.merge!(:params => request.query_parameters)     redirect_to redirect_options   end  end end  force_ssl end 

how can ensure devise resource maintained in re-direct http https?

thanks


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -