So far I had the a SIMPLA-CMS Site running on a company server and was pulling the DATA via GITHUB from NETLIFY. Since about a week I get a CORS error for the live site www.bienehuus.ch.
# The following redirect is intended for use with most SPAs that handle
# routing internally.
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
[[headers]]
# Define which paths this specific [[headers]] block will cover.
for = "/*"
[headers.values]
Access-Control-Allow-Origin = "*"
The Problem is still happening. I checked with the SIMPLA devs and they say it must be on NETLIFY side.
This is urgent since it is a life site for a client.
Hi, another person ran into a similar issue here. Not sure if it’s related but I recommend trying isomorphic-fetch - npm as an alternative to axios and see if that works better.
i haven’t heard of that package but i ended up switching to node-fetch and it seemed to work. i’d be curious where the problem is, whether it’s with axios or not though. the odd thing to me is that the local requests work fine when using axios POST
Hard to say what causes it, but we can’t really provide tech support at that depth within your source code. Glad to hear that you found a workaround though!
how was that the solution? what did you change? I am having the same issues… after they changed the .com to .app, both my sites stopped working… and threw a CORS error.
It is also possible, that if you are getting the CORS error from a service other than Netlify, that you should update the list of allowed domains there from site.netlify.com to site.netlify.app. This is usually done in an Access-Control-Allow-Origin HTTP response header.
I am not referencing any abosolute URL… where is that done and what is that?
I have two react apps - that make api calls to News Api calls using axios.
The site worked fine for 6 months, until Netlify changed the .com to app, since then none of my sites work.
On my local server, both my sites work fine with no errors but on Netlify, I have CORs errors, plus a bunch of others… it so weird that is works fine on local but not fine on Netlify, which makes me think there is something I have to do in Netlify… any help would be awesome…
Please also fogive me, I am a totally newbie to making api calls…
ainneo, did you sign up for an API key or something of that sort? If yes, did you have to supply a URL to get that key? There is a good chance that you’ll need to change the URL from .com to .app in that case.
i do have a key from News API. i did not have to supply a URL to get the key. they just assign the key, in which i use with the URL. why would i change the news api URL from .com to .app?
this is how i am making my api call… I feel I must be missing a step to make it work on Netlify/but it did work for 6 months…:
sometimes you need to supply a URL to the company/organization hosting the API when you sign up, in order to obtain an API key. It varies from organization to organization as to whether they ask for this or not. Seems like News API does not ask for this, so you can likely disregard.
I don’t have a solution to your problem at the moment, but thought I would clarify on my comment above.
If the API stopped working as soon as the .com to .app migration took place, this is certainly because a link to yoursite.netlify.com exists in your code/HTML/redirects. Please ensure you’ve searched your repo/site for this!
Failing that, if you have a deploy log or your site name to hand, we can take a look.