Skip to content

Instantly share code, notes, and snippets.

@afiedler
Created February 3, 2015 17:24
Show Gist options
  • Save afiedler/c06b12f6476d855ac237 to your computer and use it in GitHub Desktop.
Save afiedler/c06b12f6476d855ac237 to your computer and use it in GitHub Desktop.
Lock down Heroku with HTTP Auth
# in config/environments/production.rb
if ENV['HTTP_AUTH'].present?
config.middleware.use '::Rack::Auth::Basic' do |u, p|
[u, p] == ENV['HTTP_AUTH'].split(',')
end
end
# Set HTTP_AUTH on staging:
# $ heroku config:set HTTP_AUTH=username,password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment