您无法使用 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)
| 归档时间: |
|
| 查看次数: |
9556 次 |
| 最近记录: |