Issue regarding Access-Control-Allow-Origin header to AWS

  • 1 March 2017
  • 2 replies
  • 160 views


 Hi Support,




I am developing an apps and using AWS Javascript SDK to make API to AWS S3 bucket. The problem is that I encountered a CORS issue which disallow my call to AWS S3 bucket. I have no problem to use the same code on my server to talk to S3.




============ ERROR =============
XMLHttpRequest cannot load
https://s3-ap-southeast-1.amazonaws.com/s3.demo.mydomain.com/test.json.
Response to preflight request doesn't pass access control check: No
'Access-Control-Allow-Origin' header is present on the requested
resource. Origin 'https://mydomain.freshdesk.com' is therefore not
allowed access.




Error: Network Failure
  at XMLHttpRequest.<anonymous> (aws-sdk-2.9.0.min.js?_=1488368547259:6) "NetworkingError: Network Failure
  at XMLHttpRequest.<anonymous> (https://s3-ap-southeast-1.amazonaws.com/awk-sdk/aws-sdk-2.9.0.min.js?_=1488368547259:6:31259)"






That being said, I suspect it is something to do with domain whitelisting in manifest.xml file. After did that, it returned error when validate the code. I believe the sign "-" that caused the trouble, please advise.




Validation errors:
  1. Invalid domain(s) mentioned in manifest.yml: https://s3-ap-southeast-1.amazonaws.com




Keen



This topic has been closed for comments

2 replies







Hello Keen,




To solve this, CORS configuration must be enabled for the specific bucket.


Reference: Steps to enable CORS can be found at this link http://docs.aws.amazon.com/AmazonS3/latest/UG/EditingBucketPermissions.html




Check your ticket status - https://support.freshdesk.com/support/tickets/1040184




Thanks,


Rohit