是否可以在Heroku上设置VPN?

Jus*_*tin 11 cloud vpn heroku openvpn

是否可以在heroku上使用openVPN设置VPN以保持暂存环境的私密性?如果是这样,任何人都有写或链接?

Dav*_*lar 4

您无法使用 VPN 来执行此操作,但您可以使用密码保护站点的临时实例。为了做到这一点,您需要设置一个名为“staging”的新 Rails 环境,并在您的 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
Run Code Online (Sandbox Code Playgroud)

然后,您需要确保暂存实例的环境:

heroku config:add RACK_ENV=staging
Run Code Online (Sandbox Code Playgroud)