I am using magento search api in my application which based on vue but I am getting cors issue
Access to fetch at 'https://staging.crane.com/search/ajax/suggest/?q=1' from origin 'https://local.com:8092' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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.
Hi @sidharth_kothar
Kindly refer below link:
https://magento.stackexchange.com/questions/287239/how-to-enable-cors-to-access-magento-rest-apis-ma...
It may help you to resolve issue.
If issue resolve, please click on 'Kudos' & accept as Solution!
@Bhanu Periwal Thanks for reply
but I am looking for module level changes
Hi @sidharth_kothar
Please use this module :
https://github.com/graycoreio/magento2-cors
This module use for "that enables configurable CORS Headers on the GraphQL and REST APIs" .
it can help you to resolve issue.
This is security protocol and we need to provide CORS headers to the Magento 2 GraphQL to get accessed from cross origin.
This extension will help you.