Rails:如何快速保护整个站点以在 Heroku 上进行开发测试?

发布于 2025-01-03 18:46:41 字数 201 浏览 0 评论 0原文

我正在开发一个将从 Heroku 运行的网站,我即将将原型推送到 Heroku 进行测试,并确保我拥有让它运行的所有正确设置那里。我想要一种快速而肮脏的方法,将整个网站置于一个简单的登录名/密码后面,以便在轻度测试期间不向公众开放。如果它只是几行代码并且没有深深嵌入到应用程序中,那就最好了。

您将如何在 Heroku 上快速保护整个 Rails 3.2 应用程序的安全?

I'm developing a site that will run from Heroku and I'm about to the point where I would like to push a prototype to Heroku for testing purposes and to make sure that I have all of the proper settings in place for it to run there. I would like a quick and dirty method of putting the entire site behind a simple login/password so that it's not open to the public during this period of light testing. It would be best if it is just a few lines of code and not deeply embedded in the app.

How would you go about quickly securing an entire Rails 3.2 app on Heroku?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

秋心╮凉 2025-01-10 18:46:41

http_basic_authenticate_with 是一个简单的单行代码,如果您将其添加到 application_controller.rb

http://apidock.rb 中。 com/rails/ActionController/HttpAuthentication/Basic

http_basic_authenticate_with is a simple one liner if you add it to you application_controller.rb

http://apidock.com/rails/ActionController/HttpAuthentication/Basic

终难愈 2025-01-10 18:46:41

如果您不介意使用基本身份验证,这个答案很好地涵盖了您的选择。

If you don't mind using Basic Auth, this answer covers your options pretty well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文