gberger
gberger

Reputation: 2863

Cross Domain AJAX to Amazon S3 on Chrome

The following request works in Firefox but not in Chrome:

$.ajax({
    url:'http://pucquepariu.s3.amazonaws.com/exercicios/1/INF1005-Site-1-1-solucao.c?1366303788',
    success:function(data){
        alert(data)
    }
})

Here is my CORS configuration on my Amazon AWS S3 bucket:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedHeader>Content-Type,Depth,User-Agent,X-File-Size,X-Requested-With,If-Modified-Since,X-File-Name,Cache-Control</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

Upvotes: 2

Views: 1366

Answers (1)

gberger
gberger

Reputation: 2863

Got it!

Had to use the crossDomain: true option on the ajax call:

$.ajax({
    url:'http://pucquepariu.s3.amazonaws.com/exercicios/1/INF1005-Site-1-1-solucao.c?1366303788',
    crossDomain: true,
    success:function(data){
        alert(data)
    }
})

Upvotes: 1

Related Questions