简体   繁体   English

从浏览器直接上传到S3(亚马逊)和https麻烦

[英]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. 此代码段将这些文件发送到我的Amazon S3存储桶。

<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. 一切正常,但我面临https问题。 Main browsers don't trust s3-eu-west-1.amazonaws.com and show security message about untrusted connection. 主浏览器不信任s3-eu-west-1.amazonaws.com并显示有关不受信任连接的安全消息。

I changed my the HTTPS connection to HTTP so that my customers don't face any problem. 我将HTTPS连接更改为HTTP,以便我的客户不会遇到任何问题。 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. 亚马逊的S3通配符证书仅适用于一个级别的子域,因此bucket.s3-eu-west-1.amazonaws.com很好,但是bucket.bucket.s3-eu-west-1.amazonaws.com不是。 Use this instead: 请改用:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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