'Aws-sdk s3 upload CORS error cause by CacheControl Option
My code is looks like this and when
import { FileUpload } from "../types/scalars/Upload.scalar";
new S3.ManagedUpload({
params: {
ACL: "public-read",
Bucket: process.env.AWS_BUCKETNAME || "",
Body: upload.createReadStream(),
Key: filename || upload.filename,
CacheControl: "max-age=604800,public,immutable",
},
// tags,
}).promise();
If I upload this with the CacheControl option, upload works fine.
But when I load it on the client side I get a CORS error.
If I remove CachControl, obviously the CORS error doesn't come up.
My Bucket has CORS-Policy like this
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"POST"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": []
}
]
Headers with CacheControl Param
Headers without CachControl Param
With CacheControl param, My Allow headers are gone. Why is that?
I found some documents in here https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


