Open Graph Object Debugger on Symfony2 : Document returned no data on some pages

1k views Asked by At

I'm trying to Share a page with Facebook. I'm using Symfony2 on AWS.

When I want to share the home page, all informations are correctly fetched from the webpage. But when I want to share another page, Symfony2 return a 500 http error.

The working page :

Meta informations :

<meta property="og:image" content="http://wearethemodels.co/img/blogueuses.png"/>
<meta property="og:title" content="Des looks tendances pour toutes les morphos." />
<meta property="og:description" content="Trouvez les vêtements qui vous vont grâce à des models à votre image. Vous aussi, devenez MODEL et recommandez vos vêtements !" />

An example of a non-working page :

Meta informations :

<meta property="og:image" content="{{ feed.photos[0].webPath }}"/>
<meta property="og:title" content="Le look de {{ feeder.username }} sur WeAreTheModels.co !" />
<meta property="og:description" content="We Are The Models est un site pour découvrir et acheter des tenues tendance portées par des femmes qui vous ressemblent. Morpho, style ... choisissez vos critères et trouvez le look parfait !" />
<meta property="og:url" content="{{ url('this_url', {id:feed.id}) }}"/>

The two pages are in the same Symfony2 "firewall" (same authorizations are needed for the access).

I don't understand which difference exist between the two pages and why one work and not the other...

1

There are 1 answers

0
JosselinTD On BEST ANSWER

I find a solution which work , but I'm not very satisfied by it...

Using Fiddler (Fiddler website), I ask for the problematic URL and obtain a 500 error just like Facebook. But with Fiddler, I can have the whole answer ! Youhou !

I obtain this error :

Failed to start the session: already started by PHP.

Curiously, I don't have any error from my navigator. Is it some kind of weird programmation magic ?

It appear that this error is generated by the generation of a crsf_token('authenticate'). The simpliest and fastest way for me to solve it was to add a Twig condition arround the form containing this token :

{% if "facebookexternalhit" not in app.request.headers|escape %}
... the form...
{% endif %}

If someone has a better solution,I will love to modify this uggly fix...