views:

173

answers:

1

Is it possible to setup a VPN using openVPN on heroku to keep a staging environment private? If so, anyone have a writeup or links?

+2  A: 

You can't do this with a VPN, but you could password protect a staging instance of your site. In order to do this you'd want to set up a new Rails environment called "staging" and include something like the following in your ApplicationController:

class ApplicationController

  before_filter :password_protected if Rails.env.staging?

  protected

  def password_protected
    authenticate_or_request_with_http_basic do |username, password|
      username == "foo" && password == "bar"
    end
  end

end

You would then need to make sure your staging instance's environment:

heroku config:add RACK_ENV=staging
David Dollar