title: Amazon s3 Javascript- No 'Access-Control-Allow-Origin' header is present on the requested resource
body: <p>Am trying to upload my file via: </p>
  
  <pre><code>console.log("not broken til here");
      scope.inputMemeIsFile=true;
      var bucket = new AWS.S3({params: {Bucket: 'townhall.images'}});
      file = image.file;
      console.log(file);
  
      var params = {Key: file.name, ContentType: file.type, Body: file};
        bucket.upload(params, function (err, data) {
          var result = err ? 'ERROR!' : 'UPLOADED.';
          console.log(result);
          console.log(err);
        });
  </code></pre>
  
  <p>However, am getting the following error: </p>
  
  <pre><code>XMLHttpRequest cannot load https://s3.amazonaws.com/&lt;BUCKETNAME&gt;/favicon.jpg. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:5000' is therefore not allowed access.
  </code></pre>
  
  <p>with the proceedingError: <code>Network Failure {message: "Network Failure", code: "NetworkingError", time: Tue Feb 17 2015 13:37:06 GMT-0500 (EST), region: "us-east-1", hostname: "s3.amazonaws.com"…</code>}</p>
  
  <p>My CORS config looks like the following and I have tried a couple things with no luck.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"&gt;
      &lt;CORSRule&gt;
          &lt;AllowedOrigin&gt;http://*&lt;/AllowedOrigin&gt;
          &lt;AllowedOrigin&gt;https://*&lt;/AllowedOrigin&gt;
          &lt;AllowedMethod&gt;GET&lt;/AllowedMethod&gt;
          &lt;AllowedMethod&gt;POST&lt;/AllowedMethod&gt;
          &lt;AllowedMethod&gt;PUT&lt;/AllowedMethod&gt;
          &lt;AllowedHeader&gt;*&lt;/AllowedHeader&gt;
      &lt;/CORSRule&gt;
  &lt;/CORSConfiguration&gt;
  </code></pre>
  
  <p>Anyone have any idea whats wrong? I've looked at 5-6 similar posts but no one seems to be able to solve the problem. </p>