When using Facebook PHP SDK to allow users loging in with their Facebook account on a website which is hosted on Amazon and accessed via HTTPS you may get an error: Your site is stuck after redirected from Facebook after authentication and redirect forever.
To fix it, just add option trustForwarded and set it to be true when construct Facebook object:
$facebook = new Facebook(
array(
'appId' => '123',
'secret' => 'abc',
'trustForwarded' => true,
)
);