Skip to content

Added no-cache handling for preview requests#27774

Merged
9larsons merged 1 commit intomainfrom
no-cache-preview
May 7, 2026
Merged

Added no-cache handling for preview requests#27774
9larsons merged 1 commit intomainfrom
no-cache-preview

Conversation

@9larsons
Copy link
Copy Markdown
Contributor

@9larsons 9larsons commented May 7, 2026

no ref

Preview requests can include request-specific theme data, so these responses should not be stored or reused by frontend caches.

Preview requests can include request-specific theme data, so these responses
should not be stored or reused by frontend caches.
@9larsons 9larsons requested a review from allouis May 7, 2026 15:09
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e203568c-4039-48ff-b4c8-0b1911c2a899

📥 Commits

Reviewing files that changed from the base of the PR and between 9882356 and 82987b9.

📒 Files selected for processing (2)
  • ghost/core/core/frontend/web/middleware/frontend-caching.js
  • ghost/core/test/unit/frontend/web/middleware/frontend-caching.test.js

Walkthrough

This pull request adds preview-mode caching behavior to the frontend caching middleware. The middleware now detects the x-ghost-preview request header and immediately returns noCache cache-control headers, bypassing all other caching logic. The change imports the preview service, implements the conditional check at the start of the middleware function, and includes a unit test validating the new behavior.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Added no-cache handling for preview requests' accurately and clearly summarizes the main change: adding cache-control logic to prevent caching of preview requests.
Description check ✅ Passed The description explains the rationale for the change—that preview requests contain request-specific theme data and should not be cached—which directly relates to the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch no-cache-preview

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.

@9larsons 9larsons enabled auto-merge (squash) May 7, 2026 15:11
@9larsons 9larsons merged commit 84c4f3f into main May 7, 2026
44 checks passed
@9larsons 9larsons deleted the no-cache-preview branch May 7, 2026 15:35
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