Skip to content

fix(blocks): allow staging as a default draft-preview API domain - #432

Merged
tlgimenes merged 1 commit into
mainfrom
fix/preview-api-domains-stg
Aug 5, 2026
Merged

tlgimenes merged 1 commit into
mainfrom
fix/preview-api-domains-stg

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • DEFAULT_PREVIEW_API_DOMAINS only listed .preview-studio.decocms.com (production). Studio's staging environment serves the draft content API under .preview-studio-stg.decocms.com — a different suffix (-stg is its own label, not a substring match) — so previewApiOriginForHost silently rejected every staging draft pointer and resolveDraftDecofile fell back to published content with zero visible error.
  • Adds .preview-studio-stg.decocms.com to the default list, alongside the existing production entry. Both are deco-operated, so this adds no new SSRF surface (same rationale as the existing entries).

Found while validating decocms/studio#5363 (pull-based Fast Preview) against Studio's staging environment: the sandbox daemon and Studio backend were both healthy and serving the correct content, but the deployed site's server-side fetch of the draft decofile never fired because the staging domain didn't match the allowlist.

Test plan

  • Added a case to previewApiOriginForHost's existing test asserting the staging suffix resolves correctly
  • Updated the pinned DEFAULT_PREVIEW_API_DOMAINS contract test
  • bun test packages/blocks/src/cms/draftSource.test.ts — 28/28 pass
  • bun run --filter='./packages/blocks' typecheck — clean
  • Confirmed no regressions: full bun test packages/blocks has the same 107 pre-existing failures (unrelated migration-template tests) with and without this change

🤖 Generated with Claude Code


Summary by cubic

Allow staging draft-preview API domain by default to stop silent fallbacks to published content on Studio staging. Adds .preview-studio-stg.decocms.com to DEFAULT_PREVIEW_API_DOMAINS so staging draft pointers resolve via previewApiOriginForHost.

  • Bug Fixes
    • Add .preview-studio-stg.decocms.com alongside .preview-studio.decocms.com in DEFAULT_PREVIEW_API_DOMAINS (both deco-operated; no new SSRF surface).
    • Extend tests: assert staging suffix resolves in previewApiOriginForHost; update the default domains contract test.

Written for commit adfaa8b. Summary will update on new commits.

Review in cubic

DEFAULT_PREVIEW_API_DOMAINS only listed .preview-studio.decocms.com
(production). Studio's staging environment serves the draft content
API under a different, non-matching suffix,
.preview-studio-stg.decocms.com — -stg is its own label, not a
substring match of the production domain — so previewApiOriginForHost
silently rejected every staging draft pointer and resolveDraftDecofile
fell back to published content with no visible error anywhere.

Both are deco-operated, same as the existing entries, so this adds no
new SSRF surface.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@tlgimenes
tlgimenes requested a review from a team August 5, 2026 03:22
@tlgimenes
tlgimenes merged commit 65af69e into main Aug 5, 2026
1 check passed
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 7.31.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant