Facing CORS issue while using presigned url in Frontend iFRAME

0

Hi Team We are facing similar issue . Issue: Even though CORS policy is set . When we use the generated Presigned URL in frontend IFRAm we ended up with CORS error We already did the below:

  1. CORS policy is set for S3 bucket as below:
rule := types.CORSRule{
		AllowedHeaders: []string{"*"},
		AllowedOrigins: []string{"*"},
		AllowedMethods: []string{"GET", "HEAD"},
		ExposeHeaders:  []string{"Access-Control-Allow-Origin"},
	}
	_, err := c.s3.PutBucketCors(ctx, &s3.PutBucketCorsInput{
		Bucket: aws.String(name),
		CORSConfiguration: &types.CORSConfiguration{
			CORSRules: []types.CORSRule{rule},
		},
	})
  1. We are generating Pre-signed URL which for our images . It also seems to be working fine . Because when we put the presigned url in browser , it downloads the image .
  2. We are able to see the presigned images on frontend iFRAME but while downloading it ended up with CORS error

Can you please guide us , what wrong we are doing

Ranbir
질문됨 6달 전315회 조회
1개 답변
0

Hi,

I'd suggest you to give a deep read to https://aws.amazon.com/blogs/media/deep-dive-into-cors-configs-on-aws-s3-how-to/

It explains in full details how to properly work with pre-signed S3 URLs and CORS policies.

Best,

Didier

profile pictureAWS
전문가
답변함 6달 전

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

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

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

관련 콘텐츠