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

Add Content-Type: text/html; charset-utf8 #39

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mhluska
Copy link

@mhluska mhluska commented Mar 28, 2018

This is lightly tested on my local machine. I think we need to add this because the initial FastBoot request is missing a content-type header. See my issue here: ember-fastboot/fastboot-app-server#78

This is important because some Node-based crawlers simply break without a content-type header. Also Twitterbot doesn't seem to be able to get meta tags when this header is not present.

@jimsynz
Copy link

jimsynz commented Jun 8, 2018

I had a user report to me that Safari just downloads the HTML file immediately and I believe this is because my site has the X-Content-Type-Options header set to nosniff. 😞

@mhluska
Copy link
Author

mhluska commented Oct 10, 2018

I've realized this is only needed in the chunkedResponse case. I've updated the PR.

@mhluska
Copy link
Author

mhluska commented Oct 10, 2018

Note: I still had to add this in fastboot-app-server to get things working in production 🤷‍♂️ :

// HACK: When using `chunkedResponse` we have to explicitly set the content
// type otherwise the header is missing.
app.use(function(req, res, next) {
  if (!req.url.includes('.')) {
    res.type('html');
  }
  next();
});

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

Successfully merging this pull request may close these issues.

None yet

2 participants