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 7599311
In Process

The Archive Base Latest Questions

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

Related: Rails 3 SSL routing redirects from https to http (unfortunately didn’t work). Duplicate,

  • 0

Related: Rails 3 SSL routing redirects from https to http (unfortunately didn’t work).

Duplicate, but the answer didn’t work for me: setting up ssl on devise

I have a web app that’s been working fine for a while now but I need to add SSL to the login/edit acct paths. I’m using Devise for authentication. I found an entry in the devise wiki that made the process seem pretty simple, but damn if I can get it to work. The simple part was this:

#in config/environments/production.rb
config.to_prepare { Devise::SessionsController.force_ssl }
config.to_prepare { Devise::RegistrationsController.force_ssl }

And then there’s about 25 lines of code in this gist: https://gist.github.com/1040964

I got that to work well enough, but when ever I sign out I get a 301 from the sessions DELETE action that sends me to a GET.

Started DELETE "/users/sign_out" for 98.246.164.160 at 2012-03-02 01:45:42 +0000
[02 Mar 01:45 10886   INFO]   Processing by Devise::SessionsController#destroy as HTML
[02 Mar 01:45 10886   INFO]   Parameters: {"authenticity_token"=>"fI4VZ4V0Go2Civo3sJz8Dv5/Wtaa90ynaYr+xxx="}
[02 Mar 01:45 10886  DEBUG] Parameters: {"_method"=>"delete", "authenticity_token"=>"fI4VZ4V0Go2Civo3sJz8Dv5/Wtaa90ynaYr+xxxx=", "action"=>"destroy", "controller"=>"devise/sessions"}
[02 Mar 01:45 10886   INFO] Redirected to https://ec2-xx-xx-106-255.us-west-2.compute.amazonaws.com/users/sign_out
[02 Mar 01:45 10886   INFO] Completed 301 Moved Permanently in 3ms

Started GET "/users/sign_out" for xx.xx.164.160 at 2012-03-02 01:45:42 +0000
[02 Mar 01:45 10886  FATAL] 
ActionController::RoutingError (No route matches [GET] "/users/sign_out"):

So I think I need to start over from scratch. What’s the simplest way to make any Devise path use https, but the rest of the paths in my app use http? I tried this (from the SO post at the top):

 #devise routes
  scope :protocol => 'https://', :constraints => { :protocol => 'https://' } do
    devise_for :users, :controllers => { :registrations => :registrations }
    devise_for :admins
  end

But no go. I need a better suggestion.

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

    No answers yet, so here’s what I concluded:

    1. Once you access a site via https, don’t access it via http until the user signs out (firesheep attack). There’s a lot of stuff on Devise in the article linked above that discusses only having https on the sign in / out page. Bad idea.

    2. All you really need is this:

      #in config/environments/production.rb
      config.to_prepare { Devise::SessionsController.force_ssl }
      config.to_prepare { Devise::RegistrationsController.force_ssl }
      
    3. I had a ton of issues surrounding ‘after_sign_in_path’ from Devise. It turns out that after_sign_out_path_for is expecting a path to be returned — it’s not an event, it is asking where the user should be directed. So I returned root_path :protocol => 'http://' and that took care of it.

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

Sidebar

Related Questions

I just upgraded from rails 2.3.5 to rails 2.3.8, but now my redirects are
Maybe it's related to this issue: https://github.com/thoughtbot/paperclip/issues/issue/346 But in Rails 3.0.3 (ruby 1.9.2) I
Related to: Query Windows Search from Java But this time to use OSX's spotlight
This is programming related, even if not directly. The articles from Rails Dispatch make
In this exercise from O'Reilly's Head first Rails (ed. 2009) there are 2 related
I'm creating two related Rails applications, and I'm noticing a lot of non-DRY work.
This question relates to this SO question and answer (rails-3-ssl-deprecation ) where its suggested
I'm using jQuery with rails and have the following piece of code $('#related').html(<%= render
My question is related to How to rescue timeout issues (Ruby, Rails) . Here's
Related to https://stackoverflow.com/questions/139944/where-can-one-find-free-software-icons-images I have a need for free weather-related icons. Specifically, I need

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.