Closed GoodMirek closed 9 years ago
After another research I have found this is outstanding issue for two years already. Would be nice to fix at least the documentation. https://forums.aws.amazon.com/thread.jspa?messageID=551510
@GoodMirek the SDK does not implement CORS, it is a feature of your browser. If you are seeing this error, it means the CloudSearchDomain client does not support CORS. Note that this is mentioned in the guide as well as the docs for the command line browser builder new browser builder for the SDK (only CORS services have the globe icon). All of these docs explain that building a custom version of the SDK is primarily meant for usage outside of CORS environments. That said, this documentation could be made more explicit.
@lsegal Thanks for your quick response. These links are useful, but if they explicitly mention that CORS is not supported by other than default services then it would be even clearer, at least to me. Also page with CloudSearch documentation API can mention that CloudSearch does not support CORS. The browser builder for the SDK is a new for me, would be great if can be referred from Building the SDK guide .
What is still not clear to me is why SDK tries to send HTTP OPTIONS request towards CloudSearch API, which seems not to support OPTIONS request at all. The OPTIONS request fails even in environment without CORS, see the CURL output in my first post.
What is still not clear to me is why SDK tries to send HTTP OPTIONS request
The browser is sending this request, not the SDK. This is standard for any XHR request across domains. It is in no way controlled by the SDK and is enforced by the browser. You can learn more about the OPTIONS request on MDN's Cross-Origin Resource Sharing page.
Thanks for the explanation of OPTIONS. I am sorry I did not know it and blamed AWS SDK.
Do you think the documentation improvements I have suggested could be implemented?
@GoodMirek I've updated the developer guide to include information about the SDK builder. Thanks for reporting!
This bug report is about aws-sdk, CloudSearch and CORS. Either there is a bad implementation of CORS in aws-sdk-js -or- CORS is not supported on CloudSearch and then there is a bug consisting of:
Following code fails:
In Chrome debug console, I see general info:
Request headers:
and response:
Then, browser complaints about CORS:
and subsequent GET fails:
While using cURL the request succeds with HTTP GET method:
but fails with HTTP OPTIONS method: