Skip to content

Instantly share code, notes, and snippets.

@basti
Created May 28, 2013 07:06
Show Gist options
  • Save basti/5660974 to your computer and use it in GitHub Desktop.
Save basti/5660974 to your computer and use it in GitHub Desktop.
Force SSL for some parts of an app with ability to turn it on/off on a server level (ENV var)
if ENV['ENABLE_HTTPS'] == "yes"
config.middleware.use Rack::SslEnforcer, :only => %r{^/secure_pages}, :ignore => %r{^/assets}, :strict => true
end
# add Rack SSL Enforcer
gem "rack-ssl-enforcer", "~> 0.2.5", :require => 'rack/ssl-enforcer'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment