title: Use AWS S3 success_action_redirect policy with XHR
body: <p>I'm using <code>signed POST</code> to upload file directly to amazon S3. I had some trouble with the signature of the policy using PHP but finally fixed it and here is the <a href="https://gist.github.com/Maxwell2022/5480701#file-s3_policy_signature-php">sample of code</a>.</p>
  
  <p>This xhr request is send in javascript and I'm waiting for an answer from amazon. At first I was using <code>success_action_status</code> setting it to 201 to get the XML response.</p>
  
  <p>What I'd like to do is using the <code>success_action_redirect</code> to call a script on my server to create a record in the database.</p>
  
  <p>The reason why is that I could create the record in the database and if anything wrong happen at this stage I can return an error message directly at this point. Also it saves me another ajax request to my server.</p>
  
  <p>So I've tried to set this up specifying the <code>success_action_redirect</code> to <code>http:\\localhost\callback.php</code> where I have a script that is waiting for some parameters.</p>
  
  <p>But it looks like this script is never called and the response of the <code>xhr.send()</code> is empty.</p>
  
  <p>I think it's a cross-browser issue and I'm wondering if it would be possible to use jsonp somehow to pass-by this?
  Any ideas?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Apparently xhr is following redirect natively so it should work but when I specified the <code>success_action_redirect</code> it returns <code>error Server responded with 0 code.</code></p>
  
  <p>At first I thought it was because the redirect URL was on my local server so I've changed it to an accessible server but no chance.</p>
  
  <p>Anyone knows why it's returning this error message?</p>