HTTP GET to amazon aws from jquery or XMLHttpRequest fails with Origin not allowed Access-Control-Allow-Origin

Having some failure getting the amazon AWS security token from jQuery or XMLHttpRequest. When I send an HTTP GET from jQuery or XmlHttpRequest, I get "Origin http: // MY_IP is not allowed Access-Control-Allow-Origin." But if I paste the same URL into my browser, everything goes fine.

My code is:

var url_ = "https://sts.amazonaws.com/?Action=GetSessionToken" +
            "&DurationSeconds=3600" +
            "&AWSAccessKeyId=" + AccessKeyId +
            "&Version=2011-06-15" +
            "&Timestamp=" + encode(timestamp) +
            "&Signature=" + encode(hash) +
            "&SignatureVersion=2&SignatureMethod=HmacSHA256";
$.get(url_, function(data) {
alert("response: "+data);
});

My headers:


Accept-Ranges
198
Keep-Alive
- 3739
Content-Type text/html
, 25 2012 17:48:20 GMT
Etag "48c4862-e9b-4c34f76b13400"
Last-Modified Mon, 25 Jun 2012 17:39:28 GMT
- Keep-Alive
Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 PHP/5.3.10 Suhosin-Patch


/html, application/xhtml + xml, application/xml; q = 0.9,/; q = 0.8
Accept-Encoding gzip, deflate
Accept-Language en-us, en; q = 0.5
DNT 1
MY_IP
If-Modified-Since Mon, 25 Jun 2012 17:13:16 GMT
If-None-Match "48c127c-ea2-4c34f18fe6300"
- keep-alive
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv: 12.0) Gecko/20100101 Firefox/12.0

( URL- )


Content-Length 808
Content-Type text/xml
, 25 2012 17:31:54 GMT
x-amzn-RequestId a854ff13-beeb-11e1-b3ac-0147da731d96


/html, application/xhtml + xml, application/xml; q = 0.9,/; q = 0.8
Accept-Encoding gzip, deflate
Accept-Language en-us, en; q = 0.5
keep-alive
DNT 1
sts.amazonaws.com
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv: 12.0) Gecko/20100101 Firefox/12.0

http://www.html5rocks.com/en/tutorials/cors/,

0
1

, , , , - , :

Access-Control-Allow-Origin - XMLHttpRequest , -, javascript.

, - http://foo.com/index.html XMLHttpRequest http://bar.com/query?a=b, bar.com Access-Control-Allow-Origin , , .

Amazon AWS, , Access-Control-Allow-Origin , , .

, AWS, - flash - XMLHttpRequest, ( iphone ipads).

+1

All Articles