1

I'm using S3 for storing generated HTML and JS files (from an EC2 instance).

I'm trying to make AJAX requests from these JS files to my PHP files on my EC2 instance. So, I've added this line to my htaccess: Header set Access-Control-Allow-Origin *

When I test locally, AJAX requests are made from S3 to my localhost, it works perfectly. But when I try to make these requests to EC2 I get the "not allowed by Access-Control-Allow-Origin" message...

Does anyone know if it's possible to do such a thing ? If not is there anyway to dynamically load content to S3 files ?

Thanks

Antoine
  • 2,785
  • 1
  • 16
  • 23
  • Show your script. Does it explicitly use CORS? – Prinzhorn Oct 25 '12 at 13:06
  • Sounds like a duplicate of http://stackoverflow.com/questions/9327218/access-control-allow-origin-not-allowed-by – Martin Lyne Oct 25 '12 at 13:09
  • @Prinzhorn: my script, `$.ajax({ url: url, type: 'POST', dataType: 'json', beforeSend: function() { ... }, success: function() { ... }, error: function() { ... } });` I don't think I explicitly use CORS. MartinLyne, what's different here it's that it works when I request my local machine from S3 and not when I request EC2... (Both htaccess are the same, with Access-Control-Allow-Origin set to *) – Antoine Oct 25 '12 at 13:26

0 Answers0