这里是我的问题:原本是应该在S3 CORS设置:
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
</CORSRule>
</CORSConfiguration>
当我试图得到一个文件(使用jQuery与选项跨域=真)
从A.example.com - > B.example.com/file.js(可与正确的标题)当我试图从另一个域相同的请求:C.dev.example.com - > B.example.com/file。 JS //(失败)
然而,对于第二个例子,当我看着在我的铬首先请求选项网络日志:
它具有正确的CORS响应标头:
access-control-allow-headers: access-control-allow-headers
access-control-allow-methods: GET
access-control-allow-origin: *
access-control-max-age: 3000
content-length: 0
date: Mon, 26 Mar 2018 14:38:36 GMT
server: AmazonS3
status: 200
vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method
via: 1.1 f19281f08e79aa6c6634266c50732dd5.cloudfront.net (CloudFront)
x-amz-cf-id: S2aMKSsJspB9p2RVxLMNh49iQ3Rc0Uims-EEIcjbxC42_OpqJpoUXQ==
x-cache: Miss from cloudfront
然而,GET请求(该选项之后):
accept-ranges: bytes
content-length: 817
content-type: application/javascript
date: Mon, 26 Mar 2018 14:19:46 GMT
etag: "5b85d498318db8095a776fdcae57c624"
last-modified: Mon, 26 Mar 2018 14:19:20 GMT
server: AmazonS3
status: 200
via: 1.1 f19281f08e79aa6c6634266c50732dd5.cloudfront.net (CloudFront)
x-amz-cf-id: C0xswS08mXDHkagm3phQT59wjclwEX9ZZHXr57OpZVMHzkf432H7dg==
x-cache: RefreshHit from cloudfront
我上的Cloudfront TTL为5秒(它必须是积极的给我使用的情况下)我使用的是H2的协议,而不是HTTP / 1.1