-
-
Save kylebragger/1354223 to your computer and use it in GitHub Desktop.
Secure with SSL (Subdomain and Protocol) in Rails 3.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
before_filter :secure_with_ssl | |
private | |
def secure_with_ssl | |
if request.subdomain != 'secure' or request.protocol != 'https' | |
redirect_to :subdomain => 'secure', :protocol => 'https' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment