Skip to content

Removed experimental cacheMembersContent code#27767

Draft
jonatansberg wants to merge 1 commit into
mainfrom
remove-cache-members-content
Draft

Removed experimental cacheMembersContent code#27767
jonatansberg wants to merge 1 commit into
mainfrom
remove-cache-members-content

Conversation

@jonatansberg
Copy link
Copy Markdown
Member

Summary

  • Removes the ghost-access cookie, HMAC signing, X-Member-Cache-Tier header, and all associated middleware added in Added experimental headers to allow caching members content #20200 (May 2024) as an experiment for tier-based CDN caching of members content
  • The feature was never enabled — cacheMembersContent:enabled defaults to false in Zuul, and the Fastly VCL needed to consume the cookie was never written
  • The code also contained a bug where only status === 'active' was checked when determining a member's tier, rather than including trialing, past_due, and unpaid like the canonical isActiveSubscriptionStatus() used elsewhere — meaning if this had been enabled, paying members in grace-period states would have been served free-tier cached content

Rather than fixing dead code, this removes it entirely.

Files changed

  • ghost/core/core/server/services/members/middleware.js — removed setAccessCookies, accessInfoSession, getFreeTier, and cacheMembersContent block in createSessionFromMagicLink
  • ghost/core/core/server/services/members/members-ssr.js — removed ghost-access cookie cleanup from _removeSessionCookie
  • ghost/core/core/server/web/members/app.js — simplified /api/member route, removed config conditional
  • ghost/core/core/frontend/web/middleware/frontend-caching.js — removed calculateMemberTier, tiers API call, X-Member-Cache-Tier header; members always get private cache control (existing default behavior)
  • Tests & snapshots updated to remove caching-specific tests

Test plan

  • Existing members middleware e2e tests pass
  • Frontend caching unit tests pass
  • Members middleware unit tests pass
  • Verify no other code references cacheMembersContent, accessInfoSession, or calculateMemberTier

🤖 Generated with Claude Code

The ghost-access cookie, HMAC signing, X-Member-Cache-Tier header, and
associated middleware were added in May 2024 as an experiment for
tier-based CDN caching of members content. The feature was never enabled
(defaults to false in Zuul, no Fastly VCL was written to consume the
cookie) and contained a bug where only `status === 'active'` was checked
rather than the full set of active statuses used elsewhere.

Rather than fixing dead code, this removes it entirely:
- setAccessCookies and accessInfoSession from members middleware
- ghost-access cookie cleanup from members-ssr
- cacheMembersContent config conditional from members app routing
- calculateMemberTier and tier-based caching from frontend-caching
- All associated tests and snapshots

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7032723c-a5f7-4669-8212-c85d6839b34f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remove-cache-members-content

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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