Custom Action Opens a Preview URL on Wrong Domain
remoteURLbut on deployed studios it’s now opening it without this, causing it to open the
/api/preview?token=xxxat the studio domain
const remoteURL = '<https://xxx.vercel.app>'
const localURL = '<http://localhost:3000>'
const frontendURL =
window.location.hostname === 'localhost' ? localURL : remoteURL127.0.0.1or
0.0.0.0or some other local, non-localhost hostname? 😅
window.location.protocol === 'http:' ? localURL : remoteURLremoteURLis somehow null/empty string, but if it's defined statically that doesn't make sense
localhostis for whatever reason erroring when deploying
Was this answer helpful?
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.