Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS problem in Android device #228

Open
javgueram opened this issue Dec 18, 2018 · 10 comments
Open

CORS problem in Android device #228

javgueram opened this issue Dec 18, 2018 · 10 comments

Comments

@javgueram
Copy link

Hi,
I am trying to use this plugin to download and cache some images (each and every image is showned every second, as a forecast map). In my web browser Chrome works perfectly, but when I install the app on a real android device I could see trought logcat I am getting CORS blocking

Access to XMLHttpRequest at '<MY_URL_TO_THE_IMAGE>' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Some help?
Thanks

@cluigDE
Copy link

cluigDE commented Jan 3, 2019

I experience a similar problem.
It seems like the ionic 4 compatible version displays the image but isn't capable of storing them in the cache.
Some devs mentioned that the IonicWebView has problems since 4.2.1 and blocks CORS.

@alessandro-candon
Copy link

Hello,
I'm facing the same problem... Did you solve it?

@cluigDE
Copy link

cluigDE commented Jan 8, 2019

As far as I know the only solution might be the following:
Own the server you receive the data from and set up ACAO for whatever you need.
https://enable-cors.org/
That's at least how I solved this.

@alessandro-candon
Copy link

uff, it is a so big limit, because it isn't my server where are stored the images...

@warbadev
Copy link

am using aws s3 bucket it worked on ios perfectly now but on android i dont receive any errors but the images never shown please if its a cors thing can u change the code to use
ionicnative http and ditch the angular http since ionic native provide a proxy which solves this problem

@pcsantana
Copy link
Contributor

I'm using AWS S3 bucket and was facing the same CORS problem when I updated the ionic cordova webview to V2+.
To solve this, just configure the CORS in the Amazon console like this:

https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html

@khsed14
Copy link

khsed14 commented Jul 24, 2019

@pcsantana I'm using my own server, what should I do? It's two days that I'm searching but didn't make it yet. I think the plugin needs some debugging on ionic4

@pcsantana
Copy link
Contributor

Hi @khsed14 sorry for delay!

I did not tried yet this plugin with ionic 4, but you should implement a CORS filter in your backend. (e.g. in Java).

Also, ionic team makes some considerations here.

This plugin has too a branch for Ionic v4. You can try to use it: https://github.com/zyra/ionic-image-loader/tree/v4

Holpe it helps!

@aditbharadwaj
Copy link

iam facing the similar issue on device but also facing CORS issue with firebase ? any solutions

@Bart1909
Copy link

Bart1909 commented Feb 6, 2020

I‘m facing this issue with iOS and CloudFront in combination with S3...
I configured CORS on S3 and forward the Headers in CloudFront.

Anyone else having this problem or did solve it?

EDIT: Seems to be my own fault. As described on #277 the cache cleaning is not working for me so I deleted the folders manually. This seems to break down the plugin and causes CORS issues. If I reinstall the App, everything is working fine again til I delete the folders again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants