Rails 3.2 app with Devise 2.1.2.
When an unauthenticated user visits a URL requiring authentication, Devise redirects them to the login page and presents a flash message, like
Please log in or sign up before continuing
I am forcing SSL for session and registration:
config.to_prepare { Devise::SessionsController.force_ssl }
config.to_prepare { Devise::RegistrationsController.force_ssl }
When a user visits a URL like: https://example.com/some/internal/page (with SSL) the message appears on the login page. However when the user visits http://example.com/some/internal/page (without SSL), they are still redirected to the login page, but the flash message is missing.
I guess maybe it's getting lost because there are two redirects: one to the login page and again to the SSL login page.
How can I overcome this and get the message to display?