Facebook canvas application never loads <body> contents?

感情迁移 提交于 2020-01-13 06:06:30

问题


I've built a Facebook application which should be available on the web or as a canvas application within Facebook. My setup is like so:

SERVER             |     FACEBOOK APP     |    CURRENTLY WORKS
-----------------------------------------------------------------------------
localhost          |     quotewarsdev     |   both in app and directly
-----------------------------------------------------------------------------
quotewars2012.com  |     quote_wars       |   only by accessing directly

I've developed and deployed other Facebook apps using the same set up with no problems. Bizarrely, 90% of the requests for the production app in Facebook fail- the app loads most of the contents of <head> and then craps out. Occasionally the full page will load.

  • http://apps.facebook.com/quote_wars/
  • http://quotewars2012.com

A Django app running on the cedar stack on Heroku- I know, not really production ready - but I don't think this is the culprit as the app loads fine outside of Facebook.

If I tail the server logs I can see the server sending CSS/JS assets up through the parts of the <head> that Facebook has loaded.

  1. Maybe Facebook is trying to pre-parse the request and then serve it as described here?
  2. Maybe Facebook has an undocumented load time limit on requests from the <head>?
  3. Maybe Facebook has an undocumented limit on number of request in the <head>?

None of these theories make sense given the a problem-free load from local.

Can anyone confirm any of the above or offer any other ideas?

Meanwhile, with no indication of an error in the server logs, no error reports in the Facebook app interface, and no hint of any problems in the browser, I'm left randomly removing, reordering, and futzing with <head> tag to debug this.


回答1:


If these mad writings find their way to the eyes of even one poor soul caught in the hopeless mire between bleeding edge heroku development and apathetic facebook support then my time on this earth will have been well spent. I'm not going to offer any theories as to why this fixes the problem, but here is what I now know.

Somewhere in this request path the response was being arbitrarily truncated by either bytes or characters.

Facebook canvas app >> Zerigo DNS add-on >> Cedar Stack / Gunicorn >> Django

I confirmed this by replacing the entire contents of my application with text from project gutenberg- and sure enough, the response would sporadically be truncated at the same character each time.

Cutting out Zerigo and pointing the Facebook canvas application directly to the application address on heroku (e.g http://quotewars.herokuapp.com/) seems to have solved the issue.



来源:https://stackoverflow.com/questions/9305252/facebook-canvas-application-never-loads-body-contents

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!