Skip to content

Instantly share code, notes, and snippets.

@jslag
Created December 10, 2010 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jslag/736978 to your computer and use it in GitHub Desktop.
Save jslag/736978 to your computer and use it in GitHub Desktop.
before_filter :refinery_use_ssl
def refinery_use_ssl
if (request.fullpath =~ /^\/refinery/) && (ENV['RAILS_ENV'] == 'production')
ssl_rewrites = {
'mysite-dev.mydomain.com' => 'mysite-dev.heroku.com',
'mysite-stage.mydomain.com' => 'mysite-stage.heroku.com',
'mysite.com' => 'mysite.heroku.com',
}
if ssl_rewrites[request.host] && (request.port != 443)
redirect_to 'https://' + ssl_rewrites[request.host] + request.fullpath
return false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment