title: React, Axios issue: Response for preflight does not have HTTP ok status ( 404 not found )
body: <p>I've been trying using axios with basic auth but it always returns not found.</p>
  
  <p><strong>Here is my code</strong></p>
  
  <pre><code>const ROOT_URL='http://localhost/b2b_ecom/b2b-api/index.php/api/';
  
  export function login () {
  
  
      return function(dispatch)
      {
  
          const api = axios.create({
              mode: 'no-cors',
              credentials:'include',
              redirect: 'follow',
              auth: {
                  username: 'mouad@b2b.dz',
                  password: '123456'
              },
              headers: {
                  'Content-Type': 'application/json',
              }
          });
  
          api.post(`${ROOT_URL}site/login `).then(function(response)
          {
              dispatch({LOGIN,payload:response.data});
              return true;
  
          }).catch(function(error)
          {
              return error;
          });
  
      } ;
  
  }
  </code></pre>
  
  <p>And here it is the error I got: </p>
  
  <blockquote>
    <p>OPTIONS <a href="http://localhost/b2b_ecom/b2b-api/index.php/api/site/login" rel="nofollow noreferrer">http://localhost/b2b_ecom/b2b-api/index.php/api/site/login</a> 404 (Not Found)<br>
    Failed to load <a href="http://localhost/b2b_ecom/b2b-api/index.php/api/site/login" rel="nofollow noreferrer">http://localhost/b2b_ecom/b2b-api/index.php/api/site/login</a>: Response for preflight does not have HTTP ok status.</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/SFZwi.png" rel="nofollow noreferrer">Screenshot</a></p>