title: Cannot fetch data from localhost using Sveltekit
body: <p>In a new Sveltetkit project, I'm trying to fetch rest API from my local backed:</p>
  <pre><code>&lt;script context=&quot;module&quot;&gt;
      export async function load() {
          const url = `http://127.0.0.1:9000/v1/articles`;
          const res = await fetch(url, {
              method: &quot;GET&quot;,
              headers: {
                  &quot;Access-Control-Allow-Origin&quot;: &quot;*&quot;
              }
              });
  
          if (res.ok) {
              let articles = await res.json()
              console.log('res is:', articles);
              return {
                  props: {
                      articles: articles
                  }
              };
          }
  
          return {
              status: res.status,
              error: new Error(`Could not load ${url}`)
          };
      }
  &lt;/script&gt;
    
    &lt;script&gt;
      export let articles;
      
    &lt;/script&gt;
  
   
  &lt;h2&gt;List of articles&lt;/h2&gt;
  
  {#each articles as dastan}
    &lt;h4&gt;{dastan.title}&lt;/h4&gt;
  {/each}}
  </code></pre>
  <p>I can see the json response being printed in the server's terminal However I get this error in browser:</p>
  <pre><code>500
  Failed to fetch
  TypeError: Failed to fetch
      at load (http://127.0.0.1:3000/src/routes/articles/index.svelte:188:20)
      at Renderer._load_node (http://127.0.0.1:3000/.svelte-kit/dev/runtime/internal/start.js:953:37)
      at Renderer.start (http://127.0.0.1:3000/.svelte-kit/dev/runtime/internal/start.js:536:29)
      at async start (http://127.0.0.1:3000/.svelte-kit/dev/runtime/internal/start.js:1207:15)
  </code></pre>
  <p>And this error in the chrome's console</p>
  <pre><code>Access to fetch at 'http://127.0.0.1:9000/v1/articles' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response.
  </code></pre>
  <p>Despite  allowing all origins in the backend server (<a href="https://github.com/gin-contrib/cors" rel="nofollow noreferrer">in go gin</a>) and adding <code>&quot;Access-Control-Allow-Origin&quot;: &quot;*&quot;</code> to request above I could not remove this CORS problem. So I have no clue what else could be wrong.</p>