I have simple API in Nette. That is OK.
When I want to call the API from React, is there Error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://xxx.com/api/v1/users. (Reason: CORS request did not succeed). Status code: (null).
How to fix it?
David Grudl wrote:
Do you know Google?
I can :-) But I don't know how to write it in Nette …
header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: PUT, GET, POST"); header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");