I have a .json file in my Amazon s3 bucket when i try to access the file using http call in my Angular2 app i am getting an error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://s3.us-east-2.amazonaws.com/....../list.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
I made the file in my bucket to be public and gave the access as read, write and edit.
Here is my Angular Code:
getValue(){
return this._http.get('https://s3.us-east-2.amazonaws.com/........./list.json').toPromise().then(res => <Contact[]> res.json().data)
.then(data => {return data;});
}
My cross origin XML in AWS
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Can anyone help me resolving this issue Thanks in advance