Is there a way to set up simple http authentication for a Ruby on Rails app on heroku?

后端 未结 6 1601
夕颜
夕颜 2020-12-07 16:07

I want to set up a private staging server on heroku using simple http authentication. Is that possible?

6条回答
  •  执笔经年
    2020-12-07 16:25

    On Rails4, I got "No such middleware to insert after: Rack::Lock" error. Replace Adam's code to the below:

    # config/environments/staging.rb
    MyApp::Application.configure do
      config.middleware.use '::Rack::Auth::Basic' do |u, p|
        [u, p] == ['username', 'password']
      end
      # ...
    end
    

    See: http://www.intridea.com/blog/2013/6/4/tips-and-tricks-for-deploying-rails-4-apps-on-heroku

提交回复
热议问题