Olusanya Posted March 3, 2020 Share Posted March 3, 2020 I am trying to create React Frontend for PrestaShop, and When I tried to fetch data through the API, i got error that CORS has blocked the request. Please what Can I do to correct this error? Thanks Link to comment Share on other sites More sharing options...
Knowband Plugins Posted March 4, 2020 Share Posted March 4, 2020 Try adding the following lines in your prestashop .htaccess file. <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" </IfModule> Kindly note that setting allow origin to * is not good from the security preservative. If above solution works, you can allow the request for specific domain only (Request origin domain i.e. React App domain) by passing the domain name instead of * in the shared lines. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now