title: POST 403 forbidden CORS response when uploading an image to AWS S3 bucket ReactJS
body: <p>Hello so I am trying to upload images to AWS S3 from my React application using an NPM package called react-s3. I am using an AWS Educate account and have setup the access and secret key correctly. After I select the image and console log the output it gives me a 403 forbidden error as follows.</p>
  <p>POST <a href="https://shopkartimages.s3.amazonaws.com/" rel="nofollow noreferrer">https://shopkartimages.s3.amazonaws.com/</a> 403 (Forbidden)</p>
  <pre><code>Response {type: &quot;cors&quot;, 
  url: &quot;https://shopkartimages.s3.amazonaws.com/&quot;, 
  redirected: false, 
  status: 403, ok: 
  false, …}
  body: (...)
  bodyUsed: false
  headers: Headers
  __proto__: Headers
  ok: false
  redirected: false
  status: 403
  statusText: &quot;Forbidden&quot;
  type: &quot;cors&quot;
  url: &quot;https://shopkartimages.s3.amazonaws.com/&quot;
  __proto__: Response
  </code></pre>
  <p>My bucket policy is as follows :</p>
  <pre><code>{
      &quot;Version&quot;: &quot;2012-10-17&quot;,
      &quot;Statement&quot;: [
          {
              &quot;Sid&quot;: &quot;S3Permissions&quot;,
              &quot;Effect&quot;: &quot;Allow&quot;,
              &quot;Principal&quot;: &quot;*&quot;,
              &quot;Action&quot;: [
                  &quot;s3:Get*&quot;,
                  &quot;s3:List*&quot;
              ],
              &quot;Resource&quot;: &quot;arn:aws:s3:::shopkartimages/*&quot;
          }
      ]
  }
  </code></pre>
  <p>My CORS configuration in S3 is as follows:</p>
  <pre><code>[
      {
          &quot;AllowedHeaders&quot;: [
              &quot;*&quot;
          ],
          &quot;AllowedMethods&quot;: [
              &quot;PUT&quot;,
              &quot;POST&quot;,
              &quot;DELETE&quot;
          ],
          &quot;AllowedOrigins&quot;: [
              &quot;*&quot;
          ],
          &quot;ExposeHeaders&quot;: [
              &quot;x-amz-server-side-encryption&quot;,
              &quot;x-amz-request-id&quot;,
              &quot;x-amz-id-2&quot;
          ],
          &quot;MaxAgeSeconds&quot;: 3000
      }
  ]
  </code></pre>