Skip to content

🐛 Fixed iOS browsers asking to download "auth-frame" on posts with comments - #467

Open
octave wants to merge 1 commit into
TryGhost:mainfrom
octave:fix-ios-auth-frame-download
Open

octave wants to merge 1 commit into
TryGhost:mainfrom
octave:fix-ios-auth-frame-download

Conversation

@octave

@octave octave commented Nov 22, 2026

Copy link
Copy Markdown

On a site with comments enabled, readers on iPhone get this prompt while scrolling a post:

Do you want to download "auth-frame" on "example.com"?

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. caddy/snippets/SecurityHeaders adds X-Content-Type-Options: nosniff to 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/SecurityHeaders gets a second header block:

header {
	-X-Content-Type-Options
	match status 204
}

match makes 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 keeps nosniff, and 204s keep the other security headers.

Tests

On Caddy 2.11.7 (the image pinned in compose.yml):

  • caddy validate passes for Caddyfile.example with the new snippet.

  • A test site importing the snippet, with a route that returns 204 and one that returns 200:

    204 /ghost/auth-frame/ 200 /
    before X-Content-Type-Options: nosniff X-Content-Type-Options: nosniff
    after (absent) X-Content-Type-Options: nosniff
  • In production on consciousbychloe.com (this repo's main, Ghost 6.78.0), where we hit the prompt: through Cloudflare, /ghost/auth-frame/ now returns 204 without nosniff, while posts and /ghost/ still send it.

Not changed

next-docker has the same header in caddy/snippets/SecurityHeaders, and the same block applies there. I can open a PR against that branch too if that helps.

🤖 Generated with Claude Code

…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>
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The SecurityHeaders snippet adds a response-header rule that removes X-Content-Type-Options when the response status is 204. The existing nosniff rule remains for other responses.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Merge Risk: Minimal · up to 5c6ba

This change stops iOS browsers from prompting a download of the Ghost auth-frame when comments load. Only 204 responses lose the nosniff header, and all other responses keep it. The risk is minimal and the change is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: fixing iOS browsers prompting a download of "auth-frame" on posts with comments. The raw summary and objectives confirm the change removes X-Content-Type-Options only …
Description check Passed The description explains the problem (iOS download prompt for auth-frame on posts with comments), the cause (nosniff on a 204 response in a frame), the exact Caddy snippet change, the test results, an…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: fixing iOS browsers prompting a download of "auth-frame" on posts with comments. The raw summary and objectives confirm the change removes X-Content-Type-Options only for 204 responses in the Caddy SecurityHeaders snippet, which targets that prompt. The title is specific and accurate, and the emoji prefix does not affect its relevance.

Full details: Description check

Explanation

The description explains the problem (iOS download prompt for auth-frame on posts with comments), the cause (nosniff on a 204 response in a frame), the exact Caddy snippet change, the test results, and the scope limit (next-docker not changed). It directly describes the changeset.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ebceb0f5-e4ff-479c-a54a-73fc25baa120
Commits

Reviewing files that changed from the base of the PR and between c8508d9 and 5c6ba05.

Files selected for processing: 1

  • caddy/snippets/SecurityHeaders

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

This branch has not been deployed

No deployments
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.

1 participant