Help us understand the problem. What is going on with this article?


More than 5 years have passed since last update.
# encoding: utf-8

require 'omniauth-openid'
require 'openid/store/filesystem'

# callback先のドメインを現在のものに合わせる => reverse proxy用
OmniAuth.config.full_host = lambda do |env|
  # http or https
  scheme         = env['rack.url_scheme']

  # アプリケーションサーバーのアドレス
  local_host     = env['HTTP_HOST']

  # リバースプロキシサーバーのアドレス: リバースプロキシ側でヘッダーを送られないと意味がない
  forwarded_host = env['HTTP_X_FORWARDED_HOST']

  # リバースプロキシしてるかどうか
  forwarded_host.blank? ? "#{scheme}://#{local_host}" : "#{scheme}://#{forwarded_host}"

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :twitter, 'xxx', 'xxx'
  provider :facebook, 'xxx', 'xxx'

  # generic openid
  provider :open_id, :store =>'/tmp')
  provider :open_id, :name => 'google', :identifier => ''

CREATIVE SURVEYというサービスを作っています。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away