LoginSignup
26
25

More than 5 years have passed since last update.

本番環境のみ、BASIC認証を設定する!

Last updated at Posted at 2012-08-02

常に忘れる為、ココにメモしておきます。

app/controllers/application_controller.rb
http_basic_authenticate_with :name => ENV["BASIC_AUTH_NAME"], :password => ENV["BASIC_AUTH_PW"] if Rails.env.production?

namepasswordは、Herokuの環境変数で設定しておきます。

$ heroku config:add BASIC_AUTH_NAME=fakestarbaby
$ heroku config:add BASIC_AUTH_PW=password
26
25
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
25