有没有一种方法来设置简单的HTTP身份验证在Heroku上的应用程序? [英] Is there a way to set up simple http authentication for an app on heroku?

查看:77
本文介绍了有没有一种方法来设置简单的HTTP身份验证在Heroku上的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建立在使用简单的HTTP认证Heroku的私人临时服务器。这可能吗?

I want to set up a private staging server on heroku using simple http authentication. Is that possible?

推荐答案

当然可以。最简单的解决方法就是把一些在使用Rails的内置的基本身份验证的支持(在这里看到你的应用程序控制器:<一href=\"http://railscasts.com/episodes/82-http-basic-authentication\">http://railscasts.com/episodes/82-http-basic-authentication) ,只是包装在一个条件为你的 Rails.env 。需要注意的是在Heroku上,默认情况下RAILS_ENV设置为生产,但你可以改变这种用于非生产使用应用 Heroku的配置(http://docs.heroku.com/config-vars)。

Absolutely. The simplest solution is to just put something in your application controller that uses Rails's built in basic auth support (see here: http://railscasts.com/episodes/82-http-basic-authentication) and just wrap it in a conditional for your Rails.env. Note that on Heroku, by default the RAILS_ENV is set to production, but you can change this for your non-production apps using heroku config (http://docs.heroku.com/config-vars).

您也可以考虑安装一些路障式Rack中间件,但我只是上面去了。

You could also consider installing some roadblock-style Rack middleware, but I'd just go with the above.

这篇关于有没有一种方法来设置简单的HTTP身份验证在Heroku上的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆