Skip to content

Conversation

@sagzy
Copy link
Contributor

@sagzy sagzy commented Aug 1, 2024

ref https://linear.app/tryghost/issue/ONC-179

  • self-hosters reported seing a prompt to download "auth-frame" when visiting a post with comments enabled on iOS
  • recently, we've worked on an optimisation for comments UI to return a empty 204 for /ghost/auth-frame/ when no staff admin is authenticated (more context: 🎨 Reduced requests and 403 responses for comments auth check Ghost#19840)
  • setting X-Content-Type-Options to nosniff helps to prevent browsers from interpreting files as a different MIME type than what is specified in the Content-Type header
  • however, when returning an empty 204 response (No Content, therefore no Content-Type to check), iOS safari interprets the header as a file to download for some reason
  • with this change, we add the nosniff header to only non-empty responses (i.e. not HTTP 204)

ref https://linear.app/tryghost/issue/ONC-179

- some self-hosters reported seing a prompt to download "auth-frame" when visiting a post with comments enabled on iOS
- recently, we've worked on an optimisation for comments UI to return a empty 204 for /ghost/auth-frame/ when no staff admin is authenticated (more context TryGhost/Ghost#19840)
- setting X-Content-Type-Options to nosniff helps to prevent browsers from interpreting files as a different MIME type than what is specified in the Content-Type header
- however, when returning an empty 204 response (No Content, therefore no Content-Type to check), iOS safari interpret this header as a file to download from the url
- with this change, we add the nosniff header only to non-204 responses
@sagzy sagzy merged commit f3755e5 into main Aug 1, 2024
@sagzy sagzy deleted the fix/nosniff-header branch August 1, 2024 11:00
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.

2 participants