Skip to content

Instantly share code, notes, and snippets.

@danmayer
Created August 7, 2010 15:17
Show Gist options
  • Save danmayer/512887 to your computer and use it in GitHub Desktop.
Save danmayer/512887 to your computer and use it in GitHub Desktop.
#redirect all traffic to https over ssl with Sinatra
configure :production do
# us a simple before filter to redirect all requests in production to https
# before do
# unless (@env['HTTP_X_FORWARDED_PROTO'] || @env['rack.url_scheme'])=='https'
# redirect "https://#{request.env['HTTP_HOST']}#{request.env["REQUEST_PATH"]}"
# end
# end
#even simpler use rack-ssl-enforcer rack middle ware to do the same thing
require 'rack-ssl-enforcer'
use Rack::SslEnforcer
end
@manadart
Copy link

manadart commented Jul 3, 2012

Shouldn't it be:
require 'rack/ssl-enforcer'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment