Skip to content

Instantly share code, notes, and snippets.

@awesome
Forked from mrrooijen/force-ssl.rb
Created February 9, 2014 02:04
Show Gist options
  • Save awesome/8893097 to your computer and use it in GitHub Desktop.
Save awesome/8893097 to your computer and use it in GitHub Desktop.
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