Open pedroandradef opened 4 years ago
You need to address this issue on the server side rather than the client side.
Add the following code to the bottom of the .htaccess
in the /web
folder:
<ifModule mod_headers.c>
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Headers "accept,authorization,content-type,origin,x-auth-token"
Header always set Access-Control-Allow-Methods "PUT,POST,GET,OPTIONS,ORIGIN"
</ifModule>
It is not recommended to use Header always set Access-Control-Allow-Origin "*"
from a security perspective. So rather use the direct domain from where your frontend will be calling the api when you are ready for production.
Im using Apollo with Graphql Code Generator to do some queries but all responses has been blocked. Its just to learn so no envs there.