Skip to content

Instantly share code, notes, and snippets.

@stephensprinkle-zz
Created April 17, 2012 02:26
Show Gist options
  • Save stephensprinkle-zz/2403002 to your computer and use it in GitHub Desktop.
Save stephensprinkle-zz/2403002 to your computer and use it in GitHub Desktop.
Test for SSL + Subdomain in Production Rails Controller
before_filter :secure_subdomain_ssl
private
def secure_subdomain_ssl
if Rails.env.production?
if request.subdomain != 'secure' or request.ssl? != true
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