我设置了一个rails应用程序(3.2.3 [设计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'
答案 0 :(得分:1)
事实证明,这是nginx代理的问题,我忘了转发给定位置的Host
标头。我只是设置了标题主机,一切都很顺利。
proxy_set_header Host 'example.com';