Open mhluska opened 6 years ago
I just have been running into exactly this issue and noticed that it only shows up when using chunkedResponse: true
. Looks like using chunkedResponse: false
seems to work as a workaround. Unfortunately the readme has chunkedResponse: true
within its example, so most people starting to integrate FastBoot will likely hit this issue at some point.
I was having trouble getting some twitter cards to work, and noticed this message at the bottom: https://github.com/ember-fastboot/fastboot-app-server#scraper-issues
As of 2019-06-06, Twitter and LinkedIn's scrapers have a hard time extracting your site's metadata for sharing if chunkedResponse is set to true in your server.js file. Set chunkedResponse: false if your meta tags are in place but the Twitter card validator shows "Card not found" or LinkedIn's Post Inspector shows a 500 error.
But I actually posted in the twitter dev forum before seeing this, and got a response that it was because I'm missing a content-type header. https://twittercommunity.com/t/warn-no-metatags-found-even-though-they-are-there/127287
So maybe the issue is not the chunkedResponse but the missing content-type header? 🤔
For everyone having scraping issues with ember-fastboot apps, such as LinkedIn, Twitter, etc, setting chunkedResponse: false
solves the issue. It adds back the Content-Type: text/html
which is missing.
The initial response for the html page is missing
Content-Type: text/html; charset=utf-8
.I think the reason this is happening is
express-http-server.js
has the following code:app.get('/', fastbootMiddleware);
causes the initial request to not have the correct content-type since that is normally handled byexpress.static
.So it seems fastboot-express-middleware needs to call
.type('text/html')
somewhere.