Goal:
My angular app needs to read this json file from AWS S3 Pre-signed URL
Problem:
When I'm trying to get with http call a Pre-signed URL from S3 bucket, I'm getting an error,
https://mydomain has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
service.ts:
getPreSignedUrl(url: string): Observable<any>{
return this.http.get<any>(url)
}
app.component.ts
const url = 'https://s3.amazonaws.com/etc';
this.service.getPreSignedUrl(url)
.subscribe(data=> {
console.log(data)
})
SOLVED:
add this config to your AWS s3 bucket: