简体   繁体   中英

Upload from browser directly to S3 (Amazon) and https trouble

I have created a page from where users can upload their files. This code snippet send those files to my Amazon S3 bucket.

<form action="https://BUCKET.s3-eu-west-1.amazonaws.com/" method="post" enctype="multipart/form-data">
  <input type="hidden" name="awsAccessKey" value="ACCESS_KEY">
  <input type="hidden" name="awsSecretKey" value="SECRET_KEY"> 
  <input type="hidden" name="acl" value="private"> 
  <input type="hidden" name="policy" value="POLICY">
  <input type="hidden" name="signature" value="SIGNATURE">
  <input type="hidden" name="Content-Type" value="">
  <!-- Include any additional input fields here -->

  File to upload to S3: 
  <input name="file" type="file"> 
  <br> 
  <input type="submit" value="Upload File to S3"> 
</form> 

Everything works fine, but I am facing https problems. Main browsers don't trust s3-eu-west-1.amazonaws.com and show security message about untrusted connection.

I changed my the HTTPS connection to HTTP so that my customers don't face any problem. Does someone have any ideas on how to resolve this issue?

Chances are your bucket name has a dot in it. Amazon's S3 wildcard certificates are good for only one level of subdomains, so bucket.s3-eu-west-1.amazonaws.com is fine but bucket.bucket.s3-eu-west-1.amazonaws.com is not. Use this instead:

https://s3-eu-west-1.amazonaws.com/BUCKET/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM