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

Add Android support #24

Closed
contfedorov opened this issue Mar 23, 2022 · 3 comments
Closed

Add Android support #24

contfedorov opened this issue Mar 23, 2022 · 3 comments

Comments

@contfedorov
Copy link

contfedorov commented Mar 23, 2022

Is your feature request related to a problem? Please describe.
Sometimes I meet CORS issues on Android devices/simulators as well.

Describe the solution you'd like
It would be helpful to have the same proxy functionality on Android platform.

Describe alternatives you've considered
cordova-plugin-advanced-http can be treated as alternative. CORS restrictions do not apply for it. But it is full-featured HTTP client which functionality in many points exceeds required minimum. Single lightweight plugin for this particular task would be preferable.

UPDATE
Found this issue in cordova-android repo. It solved my problem completely.
Shortly: need to add <preference name="AndroidInsecureFileModeEnabled" value="true" /> to config.xml. It disables the CORS enforcement for Cordova 10.x.

@NiklasMerz
Copy link
Collaborator

We did some experimentation to see if we could implement the feature on Android similar to iOS. Unfortunately the WebView on Android does not have the necessary API for implementing this plugin. We could make GET requests work but POST requests are a problem.

Please check out the code and comments #17

If Android introduces a more powerful API this could change in the future but I don't think this is very likely.

@contfedorov
Copy link
Author

@NiklasMerz
Thanks. Just found a workaround for CORS problem that is built-in to cordova-android. Updated my first post accordingly. Tested for GET requests only.

@NiklasMerz
Copy link
Collaborator

Be careful. As the name already suggests this makes your app less secure and Google discourages this.

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

2 participants