CORS origins

Once the project is created, you have to make sure you have added proper CORS origin to the Sanity Project. Otherwise, the API won't be accessible from your domain/website.

Head over to your project page and click API Tab.

Now you can see CORS origin settings.

Image

By default, only http://localhost:3333 is enabled.

To work with Next.js, you have to add http://localhost:3000

For Astro Projects, add http://localhost:4321

Once you are ready, you must also add your production URL.

eg: https://myblogwebsite.com/

For each make sure "Allow credentials" is checked.

Once added, sanity will be accessible using the following URLs.

http://localhost:3000/studio

http://localhost:4321/studio

https://myblogwebsite.com/studio

Now, you can open your code editor to start customizing the content or the schema.