Access to fetch at 'url' from origin 'http://localhost:3000' 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 get this issue, i tried doing mode: "no-cors" but it still seems as though my front end cant communicate with my backend server, so i was wondering how i allow access so cors stops restricting access. Again, my code was 100% fine until i tried deploying my server
when I input into a form the request payload reflects it but it returns undefined
CodePudding user response:
This URL gives temporary access to CORS servers. You need to navigate to it and click the button "Request temporary access to demo servers." In testing, lasts about 24 hours.
https://cors-anywhere.herokuapp.com/corsdemo
If need be, just add the related prefix like so before your service:
https://cors-anywhere.herokuapp.com/https://myservice.com/
(this may not be what you asked for, but could help, the prefix is very useful)