title: js fetch cors error with Access-Control-Allow-Origin
body: <p>I have such a generic method to send post requests</p>
  <pre><code>async function postData(uri = '', data = {}) {
    let url = process.env.VUE_APP_API_URL + uri;
    const response = await fetch(url, {
      method: 'POST',
      mode: 'cors',
      cache: 'no-cache',
      credentials: 'omit',
      headers: {
        'Access-Control-Allow-Origin': '*',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(data)
    });
  
    return await handleErrors(response)
  }
  
  function handleErrors(response) {
    if (!response.ok) {
      throw Error(response.statusText);
    }
    return response;
  }
  </code></pre>
  <p>as you can see I set <code>Access-Control-Allow-Origin</code> to <code>*</code> , which means all URLs allowed, right? but for some reason I still see cors issue when sending POST requests, but <code>Access-Control-Allow-Origin</code> header exists in the request headers <a href="https://gyazo.com/f59fb77cc812f76952f7fbc243356415" rel="nofollow noreferrer">https://gyazo.com/f59fb77cc812f76952f7fbc243356415</a>.</p>