title: Sending POST request react app to Heroku but detected as OPTION but work fine when using POSTMAN
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React, {useState} from 'react';
  
  const CommentForm = (props) =&gt; {
  
      const [inputHandler, setInputHandler] = useState();
      const [nameHandler, setNameHandler] = useState();
  
      const URL_COMMENT = `https://damp-sierra-44032.herokuapp.com/API/${props.postID}/comment`
  
      const submitValue = async (e) =&gt; {
         const data = {name: nameHandler, comment: inputHandler}
         await postComment(data);
         window.location.reload()
      }
  
      async function postComment(data) {
          await fetch(URL_COMMENT, {
            method: 'POST',
            headers: {
              'Content-Type': 'application/json'
            },
            body: JSON.stringify(data)
          });
        }
      
  
      return (
          &lt;div&gt;
              &lt;form&gt;
              &lt;input type="text" name="name" placeholder="Name..." value={nameHandler} onChange={e =&gt; setNameHandler(e.target.value)} required&gt;&lt;/input&gt;
              &lt;input type="text" name="comment"placeholder={"Write comment here..."} value={inputHandler} onChange={e =&gt; setInputHandler(e.target.value)} required&gt;&lt;/input&gt;
              &lt;button type="submit" onClick={submitValue}&gt;Submit&lt;/button&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      )
  }
  
  export default CommentForm</code></pre>
  </div>
  </div>
  </p>
  <p>Above is my code for sending POST request to my herokuapp. It doesn't work and instead in the herokuapp log the request detected as OPTION therefore failed to create new comment in database</p>
  <pre><code>2020-11-02T23:51:31.954360+00:00 heroku[router]: at=info method=OPTIONS path=&quot;/API/5f9d629df576aa5950d2d72f/comment&quot; host=damp-sierra-44032.herokuapp.com request_id=98971688-f1d8-494b-ad92-8e3697da5bf0 fwd=&quot;36.81.12.81&quot; dyno=web.1 connect=1ms service=2ms status=204 bytes=301 protocol=https
  2020-11-02T23:51:32.062268+00:00 heroku[router]: at=info method=OPTIONS path=&quot;/API/5f9d629df576aa5950d2d72f&quot; host=damp-sierra-44032.herokuapp.com request_id=8c6d4c2d-eb99-4a2d-9d81-1868fe88eae0 fwd=&quot;36.81.12.81&quot; dyno=web.1 connect=1ms service=4ms status=204 bytes=302 protocol=https
  </code></pre>
  <p><strong>But</strong> when I tried to run the server locally and make request from my react app to localhost the request works just fine (succesfully creates new comment in database) and when I tried using postman and make request to heroku app sending POST request with body of {name: name, comment: comment} it surprisingly works just fine as well and the log:</p>
  <pre><code>2020-11-03T00:00:09.178300+00:00 heroku[router]: at=info method=POST path=&quot;/API/5f9d3e869d653f4dd683aab4/comment&quot; host=damp-sierra-44032.herokuapp.com request_id=a848fd35-8cdd-4318-8062-c6a415a7dedd fwd=&quot;36.81.12.81&quot; dyno=web.1 connect=0ms service=291ms status=201 bytes=243 protocol=https
  2020-11-03T00:00:09.179811+00:00 app[web.1]: [0mPOST /API/5f9d3e869d653f4dd683aab4/comment [32m201 [0m288.373 ms - 7[0m
  </code></pre>
  <p>At this point i'm very confused.</p>