Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Facebook应用程序与rails/passenger standalone/nginx。。。错误的url回调!_Nginx_Passenger_Ruby On Rails 3 - Fatal编程技术网

Facebook应用程序与rails/passenger standalone/nginx。。。错误的url回调!

Facebook应用程序与rails/passenger standalone/nginx。。。错误的url回调!,nginx,passenger,ruby-on-rails-3,Nginx,Passenger,Ruby On Rails 3,有乘客和nginx的Rails3真是太棒了 我正在构建一个Facebook connect应用程序,我使用omniauth进行身份验证 我通过在Nginx上使用Passenger来服务我的应用程序。出于某些原因,我想使用Passenger Standalone来运行应用程序 它工作正常,当我转到/auth/facebook时,它会正常转到facebook并请求许可。但是当它转到回调url时,url就是意外的url http://xyz.com:12148/auth/facebook/callba

有乘客和nginx的Rails3真是太棒了

我正在构建一个Facebook connect应用程序,我使用omniauth进行身份验证

我通过在Nginx上使用Passenger来服务我的应用程序。出于某些原因,我想使用Passenger Standalone来运行应用程序

它工作正常,当我转到
/auth/facebook
时,它会正常转到facebook并请求许可。但是当它转到回调url时,url就是意外的url

http://xyz.com:12148/auth/facebook/callback
如何在没有端口号的情况下重定向到url。。使加工顺利进行

Nginx配置

upstream xyz_upstream {
    server unix:/tmp/xyz.socket;
}
server {
    listen 80;
    server_name xyz.com;
    root /home/deploy/apps/rails3/xyz/public;
    location / {
        proxy_pass http://xyz_upstream;
        proxy_set_header Host $host;
    }
}

在的应用程序运行良好,但这是我唯一的问题

您可能应该看看这个:

使用上面发布的链接中的以下内容确实有效

(在config/initializers/omniauth.rb中)

我的工作方式是在每个环境中设置一个名为DOMAIN的全局变量。它使它能够在所有环境中工作,因此它不会在每次我更改环境时中断或需要更改。我的例子如下

(在config/initializers/omniauth.rb中)

(在config/environments/production.rb中)

(在config/environments/staging.rb中)

OmniAuth.config.full_host = "http://practicallygreen.com"
OmniAuth.config.full_host = DOMAIN
DOMAIN = "http://xyz.com"
DOMAIN = "http://staging.xyz.com"