Skip to content

Instantly share code, notes, and snippets.

@mindscratch
Created August 15, 2011 09:32
Show Gist options
  • Select an option

  • Save mindscratch/1145957 to your computer and use it in GitHub Desktop.

Select an option

Save mindscratch/1145957 to your computer and use it in GitHub Desktop.
Rails (3.0.x): request.ssl? isn't working -- monkey patch
class Application < Rails::Application
# MONKEY PATCH
#
# Calls to request.ssl? aren't working. The ssl? method relies on some environment variable(s)
# to be set and doesn't take into account the 'rack.url_scheme'. See ticket #5750 on the Rails
# lighthouseapp.com ticketing site.
# url: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/5750-requestssl-should-reflect-rackurl_scheme
def call(env)
env['HTTPS'] = 'on' if env['rack.url_scheme'] == 'https'
super
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment