title: How to debug CORS error
body: <p>I'm trying to grab an image from Amazon S3 using cross-origin resource sharing so that I can use the canvas.toDataUrl() method. </p>
  
  <p>On S3 I set the CORSconfiguration on the bucket to:</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;*&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;MaxAgeSeconds&gt;3000&lt;/MaxAgeSeconds&gt;
          &lt;AllowedHeader&gt;*&lt;/AllowedHeader&gt;
      &lt;/CORSRule&gt;
  &lt;/CORSConfiguration&gt;
  </code></pre>
  
  <p>When canvas.toDataURL() threw security error code 18, I guessed it was because the image had to be loaded with a "crossOrigin" attribute set.</p>
  
  <p>Still, no matter how I load the image from S3, for example:</p>
  
  <pre><code>&lt;img src="http://s3.amazonaws.com/storybookstorage/wood.png" crossOrigin="anonymous"&gt;
  </code></pre>
  
  <p>Chrome now gives me the error when I load this image:</p>
  
  <blockquote>
    <blockquote>
      <p>Cross-origin image load denied by Cross-Origin Resource Sharing policy. </p>
    </blockquote>
  </blockquote>
  
  <p>Can anyone help me figure out what's wrong, or even how I could pinpoint where the problem might be?</p>
  
  <p>My headers for the image request (from chrome dev tools):</p>
  
  <p>Request:</p>
  
  <pre><code> GET /storybookstorage/wood.png HTTP/1.1
   Host: s3.amazonaws.com
   Connection: keep-alive
   Cache-Control: max-age=0
   Accept: image/webp,*/*;q=0.8
   If-None-Match: "d5098b2c3d1417da8ccd9764612248ca"
   If-Modified-Since: Thu, 08 Aug 2013 01:10:23 GMT
   User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
   DNT: 1
   Referer: http://0.0.0.0:3000/items/1/
   Accept-Encoding: gzip,deflate,sdch
   Accept-Language: en-US,en;q=0.8
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code> Date:Sat, 24 Aug 2013 00:27:56 GMT
   ETag:"d5098b2c3d1417da8ccd9764612248ca"
   Last-Modified:Thu, 08 Aug 2013 01:10:23 GMT
   Server:AmazonS3
   x-amz-id-2:gyR2VMt9hec8HrGvcXvDrrRb/sOm3i/WpUaRdnpr/PY2VoaJigSdA960B0q83zzN
   x-amz-request-id:434E3571705359E9
  </code></pre>
  
  <p>Thanks!</p>