Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Content-Type header #78

Open
mhluska opened this issue Mar 27, 2018 · 3 comments
Open

Missing Content-Type header #78

mhluska opened this issue Mar 27, 2018 · 3 comments

Comments

@mhluska
Copy link

mhluska commented Mar 27, 2018

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:

 52     if (this.distPath) {
 53       app.get('/', fastbootMiddleware);
 54       app.use(express.static(this.distPath));
 55       app.get('/assets/*', function(req, res) {
 56         res.sendStatus(404);
 57       });
 58     }

app.get('/', fastbootMiddleware); causes the initial request to not have the correct content-type since that is normally handled by express.static.

So it seems fastboot-express-middleware needs to call .type('text/html') somewhere.

@st-h
Copy link

st-h commented Apr 19, 2019

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.

@mcfiredrill
Copy link

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? 🤔

@mariusleu
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants