1
I’m having trouble making http requests on Ionic, I saw that one way to bypass 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 I start Ionic it returns to me that the proxie has been added, but when I make the request, Cors slashes me. What am I doing wrong?