json - How to get CORS file on S3+CloudFront from WebView -
premise
structure
- json file located s3 cloudfront.
- i try json web site opened @ javafx webview.
- this cloudfront belongs domain web site.
s3
s3 cors setting following.
<?xml version="1.0" encoding="utf-8"?> <corsconfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <corsrule> <allowedorigin>*</allowedorigin> <allowedmethod>get</allowedmethod> <allowedheader>*</allowedheader> </corsrule> </corsconfiguration>
cloudfront
behavior target path following.
- forward headers: whitelist
- whitelist headers: origin
problem
i sent request json.
var url = "https://example.com/sample.json"; $.ajax({ datatype: "json", url: url, crossdomain: true, success: function(data) { console.log("<done>"); console.log("status:" + data.status); }, error: function(data, textstatus, errorthrown) { console.log("<error>"); console.log("data.status:" + data.status); console.log("status:" + textstatus); console.log("errorthrown:" + errorthrown.message); }, });
when requests sent browser(chrome), can collect response. when requests sent webview(made javafx), error. error logs here.
<error> data.status: 0 status: error errorthrown: undefined
question
how collect response webview? can edit both client(ajax) , server(cloudfront or s3 setting).
supplemental
i guess reason of error request without origin header. edit request code , try send request orign. error message refused set unsafe header "origin"
.
Comments
Post a Comment