aws-sdk javascript s3 managedUpload CORS error caused by CacheControl Option

0

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

My Upload code is following like

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();

My S3 CORS Policy is following like

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "POST"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": []
    }
]
Jihoon
질문됨 2년 전163회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인