Access Amazon s3 using http in angular2


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……/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:

My cross origin XML in AWS

Can anyone help me resolving this issue
Thanks in advance


Probably nothing to do with your Angular code. Take a look at AWS S3 docs on CORS. You need to set up a CORS configuration in your bucket. The docs provide this as an example:

The docs also say:

To configure your bucket to allow cross-origin requests, you create a CORS configuration, an XML document with rules that identify the origins that you will allow to access your bucket, the operations (HTTP methods) will support for each origin, and other operation-specific information.

This allows you to decide which origins can access your bucket (for example, if you want all origins to be able to access it, you can use the wildcard *).

Leave a Reply