title: Getting backend data with ReactJS as front-end and PHP as backend
body: <p>I am trying to work with ReactJS (16.x) as a front-end and PHP (5.x) as a backend. I am calling the API using Axios. I have a shared Linux hosting where I am trying to upload the project. It is showing CORS issues and any method apart from GET is getting 301 Moved Permanently and then the same call is occurring with OPTIONS and GET respectively.</p>
  
  <p>I have tried adding CORS to the PHP code but it is not working.</p>
  
  <p>These are the headers that I am using to avoid the CORS issue.</p>
  
  <pre><code>header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
      // header("Access-Control-Allow-Origin: http://temp.mkconsultants.co.in/");
      header("Access-Control-Allow-Credentials: true");
      header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
      header('Access-Control-Max-Age: 1000');
      header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token , Authorization');
  </code></pre>