title: AWS S3 - 400 Bad Request when PUTting file via pre-signed URL
body: <p>My Request looks like this:</p>
  <p><em>https://{my-bucket-name}.s3.amazonaws.com/{user-id}/{image-name}.jpeg?AWSAccessKeyId={key}&amp;Content-Type=image%2Fjpeg&amp;Expires=1597576628&amp;Signature={signature}</em></p>
  <p>where the {parts} are just censored but in the original response look correct, just like in a tutorial that I am doing.</p>
  <p>I have allowed public access and set both CORS (which is why I get the pre-signed URL to upload to in the first place) as well as a bucket policy that contains this:</p>
  <pre><code>    {
          &quot;Sid&quot;: &quot;{sid}&quot;,
          &quot;Action&quot;: [
              &quot;s3:GetObject&quot;
          ],
          &quot;Effect&quot;: &quot;Allow&quot;,
          &quot;Resource&quot;: &quot;arn:aws:s3:::{my-bucket-name}/*&quot;,
          &quot;Principal&quot;: &quot;*&quot;
      }
  </code></pre>
  <p>So what might be the problem?</p>
  <p>EDIT: adding PutObject to the policy did not help. I upload the file like this, from the React-client directly:</p>
  <pre><code>  const upload = await axios.put(uploadConfig.data.url, file, {
      headers: {
        'Content-Type': file.type
      }
    })
  </code></pre>
  <p>And I generate the pre-signed URL like this (note the putObject operation):</p>
  <pre><code>    s3.getSignedUrl('putObject', {
          Bucket: '{my-bucket-name}',
          ContentType: 'image/jpeg',
          Key: key
      }, (err, url) =&gt; res.send({key, url}));
  </code></pre>
  <p>Additional request headers set by the middleware/browser are:</p>
  <pre><code>Accept: application/json, text/plain, */*
  Accept-Encoding: gzip, deflate, br
  Accept-Language: en,de;q=0.9
  Cache-Control: no-cache
  Connection: keep-alive
  Content-Length: 104221
  Content-Type: image/jpeg
  Host: {my-bucket-name}.s3.amazonaws.com
  Origin: http://localhost:3000
  Pragma: no-cache
  Referer: http://localhost:3000/blogs/new
  Sec-Fetch-Dest: empty
  Sec-Fetch-Mode: cors
  Sec-Fetch-Site: cross-site
  User-Agent: Mozilla....
  </code></pre>