Allow AJAX GETs from Amazon S3? (Access-Control-Allow-Origin)

后端 未结 11 1838
灰色年华
灰色年华 2020-12-23 16:34

I\'m storing JSON objects in Amazon S3, and I\'d like to load that data directly from S3 from Javascript. My GET looks pretty generic:

$.ajax({
    \'type\':         


        
11条回答
  •  南方客
    南方客 (楼主)
    2020-12-23 17:27

    I was struggling with the same sort of issue. only difference is i wanted to pull a file with Ajax from my S3 and load it into a site.

    After a lot of searching i ended up adding this option to my Ajax request.

    xhrFields: { withCredentials: true },

    Worked like a charm, as long as you have the CORSConfiguration to allow all.

    hope it helps.

提交回复
热议问题