title: How to generate AWS S3 pre-signed URL request without knowing Content-Type?
body: <p>I am generating in server side a pre-signed URL request with the following parameters for <a href="http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/model/GeneratePresignedUrlRequest.html" rel="noreferrer">GeneratePresignedUrlRequest</a> : <code>bucket</code>, <code>key</code>, <code>expiration = in 1 hour</code> and <code>method = PUT</code>.</p>
  
  <p>In my Angular app, I am uploading the file using <a href="https://github.com/danialfarid/ng-file-upload" rel="noreferrer">ng-file-upload</a></p>
  
  <pre><code>Upload.http({
      url: $scope.signedUrl,
      method: "PUT",
      headers : {
          'Content-Type': $scope.file.type
      },
      data: $scope.file
  });
  </code></pre>
  
  <p>The problem is that I always have a <code>403</code> response unless I set the type of the file in <code>GeneratePresignedUrlRequest.contentType</code>.</p>
  
  <p>The problem is that I can't predict in advance what type of file the user will choose (<code>image/png</code>, <code>image/jpeg</code>, <code>text/plain</code>...).</p>
  
  <p>How can I generate a pre-signed url that accept all kinds of <code>content-type</code> ? I tried setting it to null, it keeps sending 403 errors.</p>
  
  <p>Thanks.</p>