Reputation: 85
I am new to aws, I have hosted all UI in s3 bucket and used cloudfont too. Now i have hosted all the restApi in EC2 instance.
angular UI -> s3 bucket (example.com) backend SpringBoot restApi -> EC2 instance (api.exaple.com)
But can someone tell how to consume the API calls hosted in EC2 (api.example.com) from S3 (example.com) bucket/ cloud front.
I have hosted sprint boot rest api in EC2 instance (api.example.com:8080).
Now i want to know how to make it work.
Upvotes: 0
Views: 462
Reputation: 4062
You need to enable CORS (Cross-Origin Resource Sharing) on your S3 bucket.
Cross-origin resource sharing (CORS) defines a way for client web applications that are loaded in one domain to interact with resources in a different domain. With CORS support, you can build rich client-side web applications with Amazon S3 and selectively allow cross-origin access to your Amazon S3 resources.
Upvotes: 1