Problems with CORS

Hello, I would like to ask you how to fix this issue.

Access to fetch at 'https://funkcniapiig.herokuapp.com/servers' from origin 'https://cranky-williams-d37c9b.netlify.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 to use a netlify.toml file, because it worked for somebody while using your Netlify services, but it didn’t work for me.

Config :
# 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 = "*"

But as you can see, it didn’t work.

I am 100% sure that the problem is with CORS, because I tried to use this google chrome extension and it works like a charm https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf?hl=en

Any idea how to fix this please?

Edit : I was able to fix this somehow. You can delete this

1 Like