I work for the first time with React, I try to send a request to my server from React application but the server does not respond:
As I understand it is necessary to configure the server on Cors
, Backend
I have OpenCart
I use Tips of good people does not help write to the script:
Header (‘Access-Control-Allow-Origin: *’);
Header (‘Access-Control-Allow-Methods: Get, Post’);
Header (“Access-Control-Allow-Headers: X-Requested-WITH”);
How to be? How to figure out?
Answer 1
decided this problem, friends for some reason, no one reminded me of http
It turns out the necessary protocol T, E HTTPS
and in the initial file index.php
Headers:
header ('access-control-allow-origin: *');
Header ('Access-Control-Allow-Methods: Get, Post');
Header ("Access-Control-Allow-Headers: X-Requested-WIT");