Topic-icon Infinite loop with jfbcCanvasBreakout=1

Active Subscriptions:

None
Hi,

Sometimes - do not ask me why and how - my site enter an inifinte loop going crazy with something like

w w w.my-site.com/somepage?jfbcCanvasBreakout=1


and looping:

w w w.my-site.com/somepage?jfbcCanvasBreakout=1&jfbcCanvasBreakout=1&jfbcCanvasBreakout=1... ad inifinium or until I press "stop" on the browser.



What is "jfbcCanvasBreakout" and how can I prevent this loop? (Ok, I admit it: since I am testing I keep logging in and out from both FB and the site... maybe I am just messing up the session cookies so bad...)
The topic has been locked.
Support Specialist
14 years 8 months ago #13587 by alzander
You should never really see that variable get added to the URL, but obviously, things aren't going perfectly for you. Our canvas detection works as follows:
1) If in a Facebook canvas, set a session variable in Joomla stating that you are
2) On any pages for that session, add a special Javascript call to the page (jfbc.canvas.checkFrame()) to look if you are no longer in an iFrame
3) If no iFrame exists, reload the page in the top frame (breaking out of the page) with that variable jfbcCanvasBreakout in the URL
4) On the reload, the session bit is cleared so we no longer check if you're in an iFrame and the URL variable is removed

If you're seeing that, it means that our session check isn't being properly removed. Can you try setting the JFBCSystem plugin the first/highest ordering to see if that helps? It may not, but that's a best first guess. Not sure, even with constant login/logout, you'd see that loop.. but we'll look into it.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
I've checked and the JFBCSystem is in the first ordering.

This does not happen all the time, but Google Analytics shows it happens undreds of times a day :(.

My app show lists of job offers. The Canvas App shows a list of jobs, with a "see more results" at bottom. This is a target="_blank" link to my site. Could this be the reason for the problem?
Based on your explanation, I just included a "?jfbcCanvasBreakout=1" on all target="_blank" links on my Canvas App to see if it prevents the loops. I'll be checking Google Analytics to see if this solves the problem...

Thanks!
The topic has been locked.
Support Specialist
14 years 8 months ago #13789 by alzander
What you describe shouldn't be the problem. We've gone over the code a few times to understand how that loop would be occurring, and just can't see it. Are you using an SEF extensions, other than core Joomla? It's possible something there is getting cached and thinking that the URL being visited should always have the ?jfbcCanvasBreakout=1 parameter in it, which obviously could be bad.

Beyond that, like mentioned, when we detect that parameter, we should be removing it from the URL so it's really never visible to the end user. One thing you can try is a slight modification to, instead of remove it, set it to '0', which should stop the loop.. to do so, edit the /components/com_jfbconnect/libraries/canvas.php file. At line 88, you'll see:
$uri->delVar('jfbcCanvasBreakout');
Try changing it to:
$uri->set('jfbcCanvasBreakout', 0);

Let us know how that goes.

Finally, I just checked our analytics logs, and this is the only page that contains the 'jfbcCanvasBreakout' on it, so we're not seeing the same thing (or haven't been missing it in our logs).

Good luck,
Alex
The topic has been locked.
Active Subscriptions:

None
Well... problem persists.

I removed the "?jfbcCanvasBreakout=1" on all target="_blank" links, since it did not help: I had hundreds of loops today, again (about 15% of site pageviews) :(

I changed the code to $uri->set('jfbcCanvasBreakout', 0); on both lines 88 and 113 on the "canvas.php" file. No result. Same problem.
I even placed a "die('Testing 1-2-3');" on those lines, and the site never died.

It seems it stucks at "jfbc.canvas.checkFrame()".

I am using Joomla 1.7.0 "out-of-the-box" - no SEF components: only JFBConnect and my own adhoc component. My component only reads data from the FB Signed Request. I never change cookie or session values (I don't touch what I don't understand).

Joomla settings are:
- SEF URLs are on
- URL rewritting is on
- Cache is off

Again: no SEF components what-so-ever.

Anyway, I changed my 'target="_blank"' links in a way to avoid using mod_rewrite rules... just to see if the problem is some mod_rewrite rules I am using...

I'll keep you posted... next monday ;)

Have a nice weekend.
The topic has been locked.
Support Specialist
14 years 8 months ago #13800 by alzander
Are you using Caching, either the setting in Global Configuration or the System - Cache plugin? Neither should cause this problem, but if enabled, try disabling for a little and see if that helps.

Otherwise, can you send the URL of the site and FB Pages with the problem. I know you've sent before, but don't have on hand. PM is fine.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
It seems the problem was on one of my redirect rules...
RewriteRule ^ads/(.*) index.php?option=com_mycomponent&view=myview&layout=mylayout&searchalias=$1 [NC]

This should be taking an URL like "/ads/london" and the perform a job search with searchalias="london", but it was loosing the "jfbcCanvasBreakout=1", if the link was generated as "/ads/london?jfbcCanvasBreakout=1".

And the solution is... to add a "/" at the end of every link. Apparently, with "/ads/london/" this works ok, but not with just "/ads/london".
The topic has been locked.
Active Subscriptions:

None
Problem came back :(

Now I am including a "QSA" flag on my mod_rewrites. To see if it solves the problem...

Question: if I simply remove the code on "jfbc.canvas.checkFrame()" the site is working ok. What are the potencial problems of not running "jfbc.canvas.checkFrame()"?
The topic has been locked.
Support Specialist
14 years 8 months ago #13870 by alzander
If you're using the same template for your Page Tab, Canvas and live site, there shouldn't be any problems removing the checkFrame. That code basically resets the template to normal 'live' template.

The QSA should fix it, but it will leave the entire query string on the URL, so you'd get /ads/london/index.php?option=c....

You may want try the following, though my mod_rewrite skillz are not 'mad'...
RewriteCond %{QUERY_STRING} jfbcCanvasBreakout=1
RewriteRule ^ads/(.*) index.php?option=com_mycomponent&view=myview&layout=mylayout&searchalias=$1&jfbcCanvasBreakout=1 [NC]

RewriteRule ^ads/(.*) index.php?option=com_mycomponent&view=myview&layout=mylayout&searchalias=$1 [NC]

Basically, the top rule will append the canvasbreakout parameter if it was originally there. The 2nd rule will trap anything else to /ads that doesn't have the jfbcCanvasBreakout param and convert like normal.

Hope that helps, and good catch on finding the problem.

Alex
The topic has been locked.