title: JS-IPFS http client via browser fails due to CORS issue
body: <p>I am doing some research and testing based on the js-ipfs-http-client browser example <a href="https://github.com/ipfs/js-ipfs-http-client/tree/master/examples/upload-file-via-browser" rel="nofollow noreferrer">here</a></p>
  
  <p>When I try to get a response from IPFS, I receive the following warning from the firefox console:</p>
  
  <p>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <a href="http://localhost:5001/api/v0/add?wrapWithDirectory=true&amp;progress=true&amp;wrap-with-directory=true&amp;stream-channels=true" rel="nofollow noreferrer">http://localhost:5001/api/v0/add?wrapWithDirectory=true&amp;progress=true&amp;wrap-with-directory=true&amp;stream-channels=true</a>. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).</p>
  
  <p>I already tried the recommended (dirty) fix where you change your IPFS config from the terminal:</p>
  
  <pre><code>ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"*\"]"
  </code></pre>
  
  <p>But not even this seems to work. I started looking into possibly using custom headers as mentioned <a href="https://github.com/ipfs/js-ipfs-http-client#cors" rel="nofollow noreferrer">here</a></p>
  
  <p>No luck.</p>
  
  <p>I set up IPFS like so:
      const ipfsClient = require('ipfs-http-client');
      var ipfs = ipfsClient('localhost', '5001');</p>
  
  <p>And then once i get some file from the user, I attempt to save it to IPFS like so:</p>
  
  <pre><code>function saveToIpfsWithFilename (file) 
  {
      console.log('running save');
  
      let ipfsId;
      const fileStream = fileReaderPullStream(file);
      const fileDetails = 
      {
        path: file.name,
        content: fileStream
      };
  
      const options =
      {
        wrapWithDirectory: true,
        progress: (prog) =&gt; console.log(`received: ${prog}`)
      };
  
      ipfs.add(fileDetails, options).then((response) =&gt; 
      {
          console.log(response)
          // CID of wrapping directory is returned last
          ipfsId = response[response.length - 1].hash
          console.log(ipfsId)
      }).catch((err) =&gt; {
          console.error(err)
        });
  }
  </code></pre>