cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.3 Search Api CORS issue

Magento 2.3 Search Api CORS issue

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.

4 REPLIES 4

Re: Magento 2.3 Search Api CORS issue

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!

Problem solved? Click Accept as Solution!

Re: Magento 2.3 Search Api CORS issue

@Bhanu Periwal  Thanks for reply

but I am looking for module level changes

Re: Magento 2.3 Search Api CORS issue

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.

Problem solved? Click Accept as Solution!

Re: Magento 2.3 Search Api CORS 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.

https://github.com/graycoreio/magento2-cors