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

  • SEARCH
  • Home
  • 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 7598775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:29:34+00:00 2026-05-30T22:29:34+00:00

I am using force_ssl in my Users and Sessions controllers. This works great. When

  • 0

I am using force_ssl in my Users and Sessions controllers. This works great. When I go actions in either of these controllers my browser will redirect to https. The problem is that after the user is redirected to https their browser will continue to use https at least when using relative URLS. I’d rather the user use http for other pages in the application. I’ve come up with 3 possible strategies to guide users back to http for other pages.

  1. Use absolute urls instead of relative urls. With this strategy I avoid using things like root_path, but instead use root_url. I can set default_url_options in my application controller to use http protocol. This way all links on in my application will attempt to guide the user back to http. They could always switch it to https in their browser manually, but I don’t really care if they do that.

  2. Write a before filter similar to https://gist.github.com/1040964. I don’t really like this because I would have to repeat which controllers / actions I am forcing to ssl in the application controller as well as the specific controller in which I use force_ssl.

  3. Use this plugin https://github.com/bartt/ssl_requirement. This plugin seems nice because it by default will force to http if I don’t say anything. Forcing to ssl seems very similar to the include force_ssl method. This seems like a good solution but I don’t want to rely on a plugin if there is a easy way to do this without it.

I can’t decided which of these 3 options is the best and am looking for guidance. I’m also new to Rails so if any of these solutions is “bad” please let me know. Also if there are other options I am not aware of please let me know.

Which solution is best if any? (Rails 3.2)

  • 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-30T22:29:35+00:00Added an answer on May 30, 2026 at 10:29 pm

    Best is the plugin. The source code to that plugin is very similar to the code in your gist. In fact, if you’re averse to the plugin, all you really need is the part here:

    https://github.com/bartt/ssl_requirement/blob/master/lib/ssl_requirement.rb#L112

    You can adapt it to your application_controller.rb or take the plugin fully.

    Cheers.

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

Sidebar

Related Questions

How do I determine and force users to view my website using HTTPS only?
I am redirecting users to https using a HttpModule for selected pages, what I
I am using Zend Framework(MVC part of it), and need to either redirect user
I'm using force_ssl (Rails 3.1, specifically in the Devise config) to make sure that
I found this code to force using www. RewriteEngine On RewriteCond %{HTTP_HOST} !^www.example.com$ RewriteRule
How can I force to SSL/https using .htaccess and mod_rewrite page specific in PHP.
I'm using Codeigniter and following these instructions to force ssl but all requests are
Is there a way to prevent users from committing without using --force when a
Using Castle ActiveRecord / NHibernate: Is there a way you can force an ICriterion
I am using the following code to force removal of surrounding frames on page

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.