sailor
sailor

Reputation: 8044

Rails + Devise how not to force SSL?

I have a staging server without valid SSL certificate. So I would like to disable SSL on my rails app to avoid browser warnings. I have tried many things to get it running, but Devise always redirect users to https URL.

My staging environment is the exact copy of my production environment except this line:

config.force_ssl = false

I tried to configure devise to force http (https://github.com/plataformatec/devise/wiki/How-To:-Use-SSL-(HTTPS)) but it doesn't work either:

class ApplicationController < ActionController::Base
  force_ssl if: :ssl_configured?

  def ssl_configured?
    false
  end
end

I'm sure i'm missing something...

Upvotes: 4

Views: 1620

Answers (1)

chemic
chemic

Reputation: 800

Take a look into your config/environments/staging.rb

and if you happen to use these lines.. remove them

config.to_prepare { Devise::SessionsController.force_ssl }
config.to_prepare { Devise::RegistrationsController.force_ssl }
config.to_prepare { Devise::PasswordsController.force_ssl }

Hope it helps :)

Upvotes: 2

Related Questions