forcing a switch between http and https in Rails
Apologies to anyone hoping for an interesting post, this is more or less public thinking aloud.
I want to be able to force one controller in a Rails project to accept connections only in https, and for attempts to connect with http to redirect to the https version. Dually, I’d like other controllers to redirect https connection attempts to the http page. Apache is set up to redirect to Rails in either event, so there shouldn’t be anything particularly tricky about it; I just need appropriate redirections. As I see it, I have two options:
- before_filter in application.rb to redirect to http: before_filter in sensitive controllers to redirect to https.
- fiddle with routes.rb to redirect at that level
