簡體   English   中英

Facebook身份驗證在Rails 3.2.3上引發錯誤

[英]Facebook authentication is raising an error on rails 3.2.3

我設置了一個Rails應用程序(3.2.3 [devise 3.4.1,omniauth facebook 2.0.0,omniauth 1.2.2] )以將facebook用作身份驗證器,並且在嘗試登錄時遇到了這個問題。問題是,它甚至沒有到達我的代碼(控制器)。 您對此有任何想法嗎?

奇怪的是,當我在主機上設置127.0.0.1 mydomain.com並瀏覽到mydomain.com:3000它可以工作! 雖然在本地,但我使用的是http而不是像生產這樣的https

Started GET "/users/auth/facebook" for x.x.x.x at 2015-02-12 00:45:05 +0000
Started GET "/users/auth/facebook/callback?code=xxxx" for 127.0.0.1 at 2015-02-12 00:45:05 +0000

URI::InvalidURIError (the scheme http does not accept registry part: app_server (or bad hostname?)):
  /home/deployer/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/uri/generic.rb:214:in `initialize'
  /home/deployer/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/uri/http.rb:84:in `initialize'
  /home/deployer/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/uri/common.rb:214:in `new'
  /home/deployer/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/uri/common.rb:214:in `parse'
  /home/deployer/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
  omniauth (1.2.2) lib/omniauth/strategy.rb:416:in `full_host'

原來,這是nginx代理的問題,我忘記了轉發給定位置的Host標頭。 我只設置了標頭主機,一切正常。

proxy_set_header Host 'example.com';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM