FIX: Added Correct CORS rules For Raw Uploaded Videos Bucket
This commit is contained in:
@@ -766,6 +766,26 @@ func main() {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The browser PUTs directly to raw-uploads-bucket using the presigned
|
||||||
|
// URL from PresignVideoUpload, so the bucket (not the cms app) is
|
||||||
|
// what needs to answer the CORS preflight — scoped to the cms
|
||||||
|
// origin the upload page is actually served from.
|
||||||
|
_, err = s3.NewBucketCorsConfigurationV2(ctx, "raw-uploads-bucket-cors", &s3.BucketCorsConfigurationV2Args{
|
||||||
|
Bucket: rawUploadsBucket.ID(),
|
||||||
|
CorsRules: s3.BucketCorsConfigurationV2CorsRuleArray{
|
||||||
|
&s3.BucketCorsConfigurationV2CorsRuleArgs{
|
||||||
|
AllowedMethods: pulumi.ToStringArray([]string{"PUT"}),
|
||||||
|
AllowedOrigins: pulumi.StringArray{pulumi.Sprintf("http://%s", cmsAlb.DnsName)},
|
||||||
|
AllowedHeaders: pulumi.ToStringArray([]string{"*"}),
|
||||||
|
ExposeHeaders: pulumi.ToStringArray([]string{"ETag"}),
|
||||||
|
MaxAgeSeconds: pulumi.Int(3000),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
discoveryRepo, discoveryService, discoveryAlb, err := deployFargateService(ctx, "discovery", 8080,
|
discoveryRepo, discoveryService, discoveryAlb, err := deployFargateService(ctx, "discovery", 8080,
|
||||||
cluster, execRole, nil, nil, vpc.Id, subnets.Ids, albSecurityGroup, serviceSecurityGroup,
|
cluster, execRole, nil, nil, vpc.Id, subnets.Ids, albSecurityGroup, serviceSecurityGroup,
|
||||||
db.Address, db.Port, discoveryPassword)
|
db.Address, db.Port, discoveryPassword)
|
||||||
|
|||||||
Reference in New Issue
Block a user