Over recent months, Facebook have become a lot stricter in relation to the use of secure URLs for applications presented in the App Canvas and on Page Tabs.
The bottom line in this is that you need to serve your Facebook application content from a secure (https) URL. You can have your app set up to serve on both http and https, but if you don’t have this https set up correctly, any Facebook user who has Secure Browsing switched on will not be able to use your application.
My reaction to this was to convert all my applications to use https for all connectivity, so as to remove any uncertainty in this regard.
I figured that the users browser would just communicate with my web server over https, regardless of whether the Facebook use was using Secure Browsing or not.
However, there is a big problem with this if you use AJAX calls in your application.
I had set up all my AJAX calls to use https, but if the viewing Facebook user isn’t using Secure Browsing (ie they are connecting to your application over http), you are going to fall foul of Browser restrictions arising from the Same Origin Policy.
That means that if your Facebook user is connecting to http://facebook.nightbluefruit.com for general application content, and the application makes an AJAX call to https://facebook.nightbluefruit.com, the browser will send the request but will refuse to receive the response.
To overcome this, you should really set up your AJAX URLs based on the protocol used to connect to your application. You can use the $_SERVER['HTTPS'] special variable to do this.