Repository navigation
Conversation
…mments Comments UI loads /ghost/auth-frame/ in an iframe when the comments section scrolls into view. Ghost answers it with a 204 for visitors who aren't signed in to Admin, and the SecurityHeaders snippet adds X-Content-Type-Options: nosniff to every response. WebKit treats a 204 with nosniff in a frame as a file, so Safari (and every other iOS browser) asks "Do you want to download auth-frame?" while the reader scrolls. The snippet now removes nosniff from 204 responses only. Every other response keeps it. Ghost-CLI's nginx template made the same change in TryGhost/Ghost-CLI#1858. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a site with comments enabled, readers on iPhone get this prompt while scrolling a post:
Comments UI loads
/ghost/auth-frame/in an iframe when the comments section scrolls into view. Ghost answers it with a204for visitors who aren't signed in to Admin.caddy/snippets/SecurityHeadersaddsX-Content-Type-Options: nosniffto every response, including that 204, and WebKit treats a 204 with nosniff in a frame as a file to download. All iOS browsers use WebKit, so Chrome on iOS shows it too.Ghost staff traced this to the nosniff + 204 combination on the forum (thread), and Ghost-CLI's nginx template got the equivalent fix in TryGhost/Ghost-CLI#1858. A 2026 report from a self-hosted 6.46 site is here. The Docker setup's Caddy snippet never got the change.
Change
caddy/snippets/SecurityHeadersgets a secondheaderblock:matchmakes the delete deferred, so it runs when the response is written, after the existing block has set the header. It only applies to 204s. Every other response keepsnosniff, and 204s keep the other security headers.Tests
On Caddy 2.11.7 (the image pinned in
compose.yml):caddy validatepasses forCaddyfile.examplewith the new snippet.A test site importing the snippet, with a route that returns 204 and one that returns 200:
/ghost/auth-frame//X-Content-Type-Options: nosniffX-Content-Type-Options: nosniffX-Content-Type-Options: nosniffIn production on consciousbychloe.com (this repo's
main, Ghost 6.78.0), where we hit the prompt: through Cloudflare,/ghost/auth-frame/now returns204withoutnosniff, while posts and/ghost/still send it.Not changed
next-dockerhas the same header incaddy/snippets/SecurityHeaders, and the same block applies there. I can open a PR against that branch too if that helps.🤖 Generated with Claude Code