Amazon s3 AmazonS3CORS可以使用HTTP,但不能使用HTTPS

Amazon s3 AmazonS3CORS可以使用HTTP,但不能使用HTTPS,amazon-s3,Amazon S3,我可以让AmazonS3通过http传递CORS头,但不能通过https。我怎样才能让它与这两者都起作用?如果我们将Akamai用作CDN会怎么样 以下是我的bucket配置: <?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOri

我可以让AmazonS3通过http传递CORS头,但不能通过https。我怎样才能让它与这两者都起作用?如果我们将Akamai用作CDN会怎么样

以下是我的bucket配置:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
   <CORSRule>
        <AllowedOrigin>https://*</AllowedOrigin>
        <AllowedOrigin>http://*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule> 
</CORSConfiguration>

一,
  • 一,

  • 我找不到明确提到它的文档,但似乎bucket的CORS配置只允许每个
    元素输入一个
    。配置中最多允许有100个
    条目。因此,为了使您的配置同时支持
    http
    https
    ,您应该创建两个条目,如下所示:

    <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
      <CORSRule>
        <AllowedOrigin>https://*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
      </CORSRule> 
      <CORSRule>
        <AllowedOrigin>http://*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
      </CORSRule> 
    </CORSConfiguration>
    
    
    https://*
    得到
    3000
    *
    http://*
    得到
    3000
    *
    

    FWIW,我还没有尝试过,但配置可能还支持协议无关格式,例如简单地
    /*

    <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
      <CORSRule>
        <AllowedOrigin>https://*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
      </CORSRule> 
      <CORSRule>
        <AllowedOrigin>http://*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
      </CORSRule> 
    </CORSConfiguration>