Skip to content

feat(core): allow domain sharding - #7061

Closed
rexxars wants to merge 3 commits into
mainfrom
feat/domain-sharding
Closed

rexxars wants to merge 3 commits into
mainfrom
feat/domain-sharding

Conversation

@rexxars

@rexxars rexxars commented Jul 2, 2024

Copy link
Copy Markdown
Member

Description

This is the studio integration side of sanity-io/client#860 - see that PR for rationale.
I'll rebase/change this PR to use a regular release of the client once the above is merged and released.

The implementation works like this:

  • We first configure and do the auth check/login on the unsharded domain. This ensures we have the right redirect URLs and such.
  • Once authenticated, we fetch the current user at the same time as we do a network check against the /ping route.
    • The ping route allows exposed network timing information (through a Timing-Allow-Origin header), which allows us to get the HTTP protocol used to access it.
    • If we detect HTTP2/3, we still use unsharded domains.
    • If the request used HTTP1, or we cannot determine the protocol (eg if the resource timing API is not available), we switch the client to sharded domains.

This is only enabled for customers with allowDomainSharding set to true, as well as the auth.loginMethod set to token. This is unfortunate, but we cannot get the auth cookie set on the regular project hostname propagated, so we have to use tokens. This does introduce overhead, since all requests will have preflight requests.

Note that this is a temporary workaround, while we work on a more permanent solution.

What to review

Either disable HTTP2/3 support (through browser flag or similar), or set FORCE_DOMAIN_SHARDING to true in createAuthStore and observe domain sharding behavior in staging. Setting the FORCE_DOMAIN_SHARDING flag back to false (or re-enabling HTTP2/3) and observe that it does not use domain sharding.

Testing

I realize this is missing tests. Since this is a temporary workaround, I find this acceptable for now. But if you feel strongly, shout out.

Notes for release

None. This is a silent release - we only want select customers to use this as a workaround, not a permanent solution.

@vercel

vercel Bot commented Jul 2, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 10:50pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 10:50pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 10:50pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 10:50pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 10:50pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Jul 2, 2024 10:50pm

@rexxars
rexxars requested a review from a team as a code owner July 2, 2024 22:44
@rexxars
rexxars requested review from bjoerge and removed request for a team July 2, 2024 22:44
@rexxars
rexxars marked this pull request as draft July 2, 2024 22:44
@rexxars
rexxars removed the request for review from bjoerge July 2, 2024 22:44
@github-actions

github-actions Bot commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

No changes to documentation

@github-actions

github-actions Bot commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

Component Testing Report Updated Jul 2, 2024 10:58 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 37s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 7s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 28s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 32s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 29s 4 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 37s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 18s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 6s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 21s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 15s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 6s 21 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 1m 22s 27 0 0

@annez

annez commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

@rexxars is this still relevant? Can you close if not?

@jordanl17

Copy link
Copy Markdown
Member

As the client PR has not been merged, closing this until that is merged and linking both together

@jordanl17 jordanl17 closed this Jan 8, 2026

This branch was successfully deployed

5 active deployments
Preview – test-next-studio — 4043f892 Deployed Jul 2, 2024 by vercel[bot]
Preview – test-compiled-studio — 4043f892 Deployed Jul 2, 2024 by vercel[bot]
Preview – test-studio — 4043f892 Deployed Jul 2, 2024 by vercel[bot]
Preview – performance-studio — 4043f892 Deployed Jul 2, 2024 by vercel[bot]
Preview – page-building-studio — 4043f892 Deployed Jul 2, 2024 by vercel[bot]
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.

3 participants