I’m uploading a file to s3, when I run it locally, it uploads the file, but when I upload my changes and run it in the api with https protocol, it returns 403
policy:
{
“Version”: “2012-10-17”,
“Statement”: [
{
“Sid”: “PublicRead”,
“Effect”: “Allow”,
“Principal”: ““,
“Action”: [
“s3:GetObject”,
“s3:PutObject”,
“s3:PutObjectAcl”
],
“Resource”: “arn:aws:s3:::my-bucket/”
}
]
}
code:
s3Config := &aws.Config{
Credentials: credentials.NewStaticCredentials("my_key", "my_value", ""),
Region: aws.String("region"),
}
s3Session := session.New(s3Config)
uploader := s3manager.NewUploader(s3Session)
input := &s3manager.UploadInput{
Bucket: aws.String("my-bucket"),
Key: aws.String(imageName),
Body: bytes.NewReader(buf.Bytes()),
ContentType: aws.String("image/jpg"),
}
_, err = uploader.UploadWithContext(context.Background(), input)
basically, when I run it locally, I can upload normally, but in the url with https I can’t