How to fix CORS error when running the app on Android emulator?

I have developed an Ionic React app, running on top of Capacitor. In browser (ionic serve) , the app runs perfectly.
When I run the app on Android, trying to login, a CORS error is shown.
How can I solve this error, taking in consideration that I cannot change the API server back end.
My Implementation:

const doLogin = (e: any) => {

const data = {

  cardNr: cardNumber,
  name: name,

.post("/login", data)
.then((response) => {
//do sth
.catch((error) => {

I have tried the following:

  1. install cordova-plugin-advanced-http, according to HTTP - Ionic Documentation : It requests to install “@angular/core”, but I’m working with React. Anyway, even after installing it, I cannot run the app successfully on Android, cannot login.

  2. install @capacitor-community/http according GitHub - capacitor-community/http: Community plugin for native HTTP : in this case, when I import ‘import com.getcapacitor.plugin.http.Http’ it shows an error: ‘Cannot resolve symbol http’.

Any help would be really appreciated. Thank you!

I solved this issue, using capacitor community http plugin: GitHub - capacitor-community/http: Community plugin for native HTTP. There is a lack of info here, but anyone interested can reply to this comment.