title: CORS not allowing post request from React
body: <p>I'm currently using the cors as middleware.
  In the API if I use</p>
  <pre><code>app.use(cors())
  </code></pre>
  <p>or</p>
  <pre><code>const allowedOrigins = [
    &quot;https://www.yoursite.com&quot;,
    &quot;http://127.0.0.1:5500&quot;,
    &quot;http://localhost:3500&quot;,
    &quot;http://localhost:3000&quot;,
  ];
  
  const corsOptions = {
    origin: (origin, callback) =&gt; {
      if (allowedOrigins.indexOf(origin) !== -1 || !origin) {
        callback(null, true);
      } else {
        callback(new Error(&quot;Not allowed by CORS&quot;));
      }
    },
    optionsSuccessStatus: 200,
  };
  
  
  app.use(cors(corsOptions))
  </code></pre>
  <p>In the axios post request from react I will get <em>{ &quot;message&quot;: &quot;Network Error&quot;, &quot;name&quot;: &quot;AxiosError&quot;....}</em></p>
  <p>But if I use</p>
  <pre><code>app.use(cors({ credentials: true, origin: true }));
  </code></pre>
  <p>The request will be allowed.</p>
  <p>Also, I'm curently requesting like this:</p>
  <pre><code> const response = await axios.post(
          BASE_URL,
          JSON.stringify({
            crd4e_name: email,
            crd4e_password: password,
          }),
          {
            headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },
            withCredentials: true,
          }
        );
  </code></pre>