Is it possible to setup a VPN on Heroku?

12,441

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
Share:
12,441
ftoyoshima
Author by

ftoyoshima

Updated on July 11, 2022

Comments

  • ftoyoshima
    ftoyoshima almost 2 years

    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?