Hi @roger !
I’m reopening this as I have issues using the web preview plugin with the sveltekit-starter-kit from DATOCMS.
My website is hosted on vercel. I setup things according to the documentation, I know the endpoint works by testing it locally.
But when I enter my development URL from vercel, I have a CORS issue :
Access to fetch at 'https://mydomain.vercel.app/api/preview-links?token=MyToken' from origin 'https://plugins-cdn.datocms.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I tried almost everything on vercel :
- Disabling deployment protection
- Adding the path
/api
OPTION ALLOWLIST in project’s settings - Adding a vercel.json config allowing the headers from /api routes.
Thanks!
(Mod note: Split from another topic and clarified which plugin was used)