WKWebView CORS issue

Hi,
Does anyone know how to solve this CORS issue I faced?
I’m trying to load an image on the HTML canvas in my Ionic app from Amazon s3
let source = new Image();
source.crossOrigin = “Anonymous”;
source.src = s3Img (An image from S3);

then I got this error.


Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.
Failed to load resource: Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.
Cross-origin image load denied by Cross-Origin Resource Sharing policy.


I also set my S3 bucket CORS configuration like this.

<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>

Does anyone know what I am doing wrong?

I’m using ionic-angular 3.7.0 and @ionic/app-script 3.0.0

Thanks a lot in advance.

You have to set the Access-Control-Allow-Origin header to allow localhost:8080 (as the error message says).