Hello,
site:
(https://appcrates.netlify.app/)
I am a newbe. I created my site on react+vite and I was doing it mostly locally.
Integrated Saniity to the blog page and everything works.
Now I am trying to see what happens on netlify deployed version.
My problem on netlif is that the blog does not work. Failed to fetch posts.
Also whatever is the visual studio, I can’t make it work and dos do not help at all.
Sanity is connected on netlify as well as github.
Please suggest what might be the issue.
Have you checked the developer console of your browser?
It shows that the requests to sanity.io
are receiving a 403 Forbidden
response:
As something else to fix, if you refresh when on the /blog
page you’ll encounter:
The fix is mentioned in the warning in the box on these pages:
https://docs.netlify.com/frameworks/react/
https://docs.netlify.com/configure-builds/javascript-spas/#build-configuration-for-javascript-spas
Avoid 404s for SPAs
If your project is a single page app (SPA) that uses the history pushState
method to get clean URLs, you must add a rewrite rule to serve the index.html
file no matter what URL the browser requests.
You need to add the rewrite rule that it links to:
https://docs.netlify.com/routing/redirects/rewrites-proxies/#history-pushstate-and-single-page-apps
Thank you for your answer.
Dev tool showed huge list of CORS errors.
AI explained that the issue is that I have not added this specific webiste adress in CORS settings in sanity. I though only ports are required.
Now I understand. Blog works.
Thank you very mucjh.
@fitcrates Great!
Don’t forget to add the rewrite if you want to avoid the 404
issue.