Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6986421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:48:23+00:00 2026-05-27T18:48:23+00:00

I have got two methods in application_controller.rb def force_ssl if !request.ssl? redirect_to :protocol =>

  • 0

I have got two methods in application_controller.rb

def force_ssl
      if !request.ssl?
        redirect_to :protocol => 'https'
      end
    end

    def no_ssl
      if request.ssl?
        redirect_to :protocol => "http"
      end
    end

also I have done before_filter :no_ssl in application.rb

Now I am trying to call force_ssl method in sessions controller of devise to secure login through SSL

In sessions_controller.rb file I have done skip_before_filter :no_ssl and before_filter :force_ssl

I am not able to login when I use this, however if I do not do before_filter :no_ssl in application_controller.rb it works fine.

Since I have got lot of controller I was trying to put before_filter :no_ssl in application.rb so that I do not have to call before_filter :no_ssl in all the controllers as it will not be DRY.

I have tried almost all the available resources and dont know why this is not working.

P.S :- This is working for my other controllers except for the devise controller
Any suggestions??

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:48:24+00:00Added an answer on May 27, 2026 at 6:48 pm
    1. You can use Bartt-SSL_Requirement, it works well in Rails 3.1, that way you don’t need the before_filter and skip_before_filter. In BarttSSLRequirement you can use the “ssl_exceptions” for your before_filter needs.

    2. SSL sometimes gives problems in Development, push it to staging and it should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two websites that post news information. I just got a request to
I have got two classes, one a subclass of the other (say Animal and
I've got two PostgreSQL databases that have been created using the same sql file.
I've got two Silverlight Controls in my project, both have properties TeamId. I would
I've got two hard disks in my computer, and have installed Solaris 10u8 on
I have got as follows: use constant ABC => ('one', 'two', 'three'); and I
I have two strings: the first's value is catdog and the second's is got.
I've got a form where I have two radio buttons and two interchangeable controls
If I have two domain names: altcognito.com and say I've got the other following
I've got the following problem: I have two tables: (simplified) +--------+ +-----------+ | User

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.