I'm having trouble doing http requests on Ionic, I saw that one way to circumvent CORS is by using proxies.
I tried something like:
ionic.config.json:
{
"name": "appIonic",
"integrations": {
"cordova": {}
},
"proxies": [
{
"path": "/loginnovo",
"proxyUrl": "https://loginsiteapixx/loginnovo"
}],
"type": "ionic-angular"
}
At my service:
basepath = "";
constructor(public _http: HttpClient, private _platform: Platform) {
if(this._platform.is("cordova")){
this.basepath = "https://loginsiteapixx"
}
}
public login(credenciais){
return this._http.post(this.basepath + '/loginnovo',
{email: credenciais.email, password: credenciais.password},
{observe: 'response'})
.pipe(
map((response) => ({data: response.body, status: response.status}))
)}
When Ionic starts it returns me that the proxie was added, but when I make the request, the cors bars me. What am I doing wrong?