Skip to content

fix(site): allow sanity.io in CSP frame-ancestors and resilient iframe visual editing - #748

Merged
codercatdev merged 3 commits into
mainfrom
fix/sanity-io-frame-ancestors
Oct 17, 2026
Merged

codercatdev merged 3 commits into
mainfrom
fix/sanity-io-frame-ancestors

Conversation

@codercatdev

Copy link
Copy Markdown
Contributor

Summary

  • Add https://*.sanity.io and https://sanity.io to Content-Security-Policy: frame-ancestors in apps/site/src/middleware.ts because https://codingcat-prod.sanity.studio redirects (302) to https://www.sanity.io/@ovF2qiKSO/studio/..., making https://www.sanity.io the top-level frame ancestor
  • Allow sanity-preview-perspective query param in resolvePreview() to enable draft preview even when nested cross-site cookies are blocked by the browser
  • Run enableVisualEditing() in BaseLayout.astro whenever inside an iframe (window.self !== window.top) or when draft mode is active

@codercatdev
codercatdev merged commit c02be98 into main Oct 17, 2026
2 checks passed
@codercatdev
codercatdev deleted the fix/sanity-io-frame-ancestors branch October 17, 2026 03:05
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