2

nginx をリバース プロキシとして使用しています。

location /facebook/
{

    proxy_pass  http://upload  #this is an nother server;
    proxy_redirect off;
}

と私のコード:

$facebook = new Facebook(array(
 'appId'  => "xx", 
 'secret' => "xxxxxxxx", 
));


$user = $facebook->getUser();


if ($user){
    $user_profile = $facebook->api('/me');
    var_dump($user_profile);
}

else
{

    $url=$facebook->getLoginUrl( array( 'scope' => $req_perms) );
    //if I used nginx I must change redirect_uri 
    $url = str_replace('http%3A%2F%2Fupload%2F', 'http%3A%2F%2F'. $mydomian .'%2F',$url);
    header("Location:".$url);
}

nginx をリバース プロキシとして使用しない場合は正常に動作しますが、使用すると$facebook->getUser()0 が返されるため無限ループが発生します。何が問題なのかわかりません。

4

1 に答える 1

0

ログインしている URL は、開発者アプリhttps://developers.facebook.com/apps/YOUR_APP_ID/summaryの[アプリを Facebook と統合する方法を選択してください] の下に設定されているものと一致する必要があります。 .

于 2012-11-08T09:47:20.317 に答える