Amazon S3 - 405 Method Not allowed using POST (Although I allowed POST on the bucket) Amazon S3 - 405 Method Not allowed using POST (Although I allowed POST on the bucket) ajax ajax

Amazon S3 - 405 Method Not allowed using POST (Although I allowed POST on the bucket)


The direct cause of the error is unrelated to CORS, and is actually caused by the fact that that the S3 website endpoints don't support POST (only the REST endpoints support it, but that's not actually related to the problem at hand).

The real problem is that you appear to be trying to use S3 for something it doesn't do.

 $.ajax({     url: 'graph-data.php',     type: 'POST',

S3 is an object store, not an application server.

You can't run php on S3. You can't execute any server-side code on S3.

You can host a static website on Amazon S3. On a static website, individual web pages include static content. They may also contain client-side scripts. By contrast, a dynamic website relies on server-side processing, including server-side scripts such as PHP, JSP, or ASP.NET. Amazon S3 does not support server-side scripting.

http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html

That same page of the documentation will point you to alternative AWS solutions for accomplishing what you want.