I copied and pasted the react netlify example from the docs, and when I try and paste my url in, it says "Failed to load settings from "
Console error: Access to fetch at 'https://<my-site>.netlify.app/.netlify/identity/settings' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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āve noticed a number of people mentioning netlify-cms, I donāt even know what that is. Also not using a git-gateway.
I have no idea why itād be doing this, itās worked for another react project in the past.
Youāre getting that error because your local server has a domain of ālocalhostā, which doesnāt match .netlify.app. Have you tried deploying your code and see if you still get that error?
Try using localhost:8888 and it will work. In my case, /.netlify/git/settings was only allowing http://localhost:8888 while /.netlify/identity/settings was allowing any host * (so one of the two worked with port 3000 as well).
LE: it actually appears when the API call times out. Couldnāt fix it with re-linking Git Gateway, yet. (when trying to access it directly at myappname.netlify.app/admin). For my other apps, it works fine.
LLE: works now (regardless of localhost and port number), took some time, uninstall/reinstalled Netlify Github App, relinked the repo, re-enabled the Identity Git Gateway.
Thanks @jozsi for reporting the issue and the solution. When working with the CMS locally with identity and git gateway, it should ask for your site URL and store it in local storage, so it knows how to connect to those services. When working with the live site it just uses the current domain. Iāve seen recent cases where it takes some time for git gateway to initialize, but it didnāt result in CORS errors so thank you for informing us. Regardless both git gateway and identity should allow any host (either by mirroring the origin or by sending a *)
Dear @erez, itās a pleasure to observe the development of the CMS on GitHub.
Iāve had the site URL set. So basically when the Git gateway was timing out (it was not yet initialized; didnāt get any response for minutes, unlike the Timeout error that happens in some scenaries like when a token re-issue is requested), the CORS prelight request responded instantly without the allowance of * hosts. Unfortunately I didnāt save the response headers and canāt reproduce anymore.
That sounds unusual @jozsi. Glad things are working for you now. If you follow @erezās steps, things should work without issue. If you are able to reproduce the issue again, please do let us know.
@JamesWholebear it look like the guys didnāt reply to you and moved the conversation away. Did you solved the issue ? You will make me so happy if you share the how to.
It sounds like running on port 8888 mightāve been the solution? (This is implying using netlify dev, the CLI command for running and serving your SSG, which defaults to using port 8888)
Yea, for the original poster, it does look like the solution was to use port 8888. There was no confirmation from the poster but I assume that since they didnāt come back that it did work.
Iām using Port 8888 and itās throwing me a page not found error.
Iāve tried using chrome extensions, relinking repo, relinking Netlify app on Github, relinking Netlify Auth. Nothing is working for me, and the same error persists:
āAccess to fetch at āhttps://{URL}/.netlify/identity/settingsā from origin āhttp://localhost:8000ā has been blocked by CORS policy: Response to preflight request doesnāt pass access control check: Redirect is not allowed for a preflight request.ā
The strange thing is when I deploy the site, I can access the CMS there. I want to be able to quickly be able to update the CMS without having to deploy to Netlify each time.
Could elaborate on that a bit? Iām not sure what you mean by subsequent start command - Netlify Dev should fire up Gastby for you, then youād view the local site on localhost:8888
@jonsully Yes, I have several different start commands after running netlify dev, I choose gatsby/yarn develop which is what initiates. localhost:8888 (the server) starts, but does not let me look at the website (it draws blank). the development build is visible on 8000 as well as the CMS on localhost:8000/admin/#
Netlify Dev is made to start your development server for you, not setup such that you should start the development server yourself after you start Netlify Dev. If a blank screen is rendering on localhost:8888, something is wrong.
I was able to resolve the issues with netlify dev and now it works as intended. Thank you for sending that resource. I (was) still unable to access the CMS with the same error as before using localhost:8888.
I did some more digging and realized that with the URL changes from earlier this year, I needed to set the URL to be my Netlify URL ā not the URL I bought as a separate domain.
So, for anyone else who stumbles on this thread, try the following:
Run localStorage.removeItem(ānetlifySiteURLā) in your browser console and refresh to reset the URL
Set the URL to be your Netlify URL and not your domain ā should look like site-name.netlify.app
Access to fetch at 'https://SITE_NAME.netlify.app/.netlify/identity/settings' from origin 'http://localhost:8888' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
I am trying to setup Netlify CMS and run it locally. Deploying it and using it from the netlify.app domain works like a charm. I tried to re-link the repo, re-enable Git Gateway, set headers in netlify.toml but none of these helped. Itās already like 10 hours for me trying to solve the issue and I still can not find the solution.