Trying to POST some JSON cross-origin and getting 403 forbidden? Hate your life? Me too.
Update to original CORS post for Ionic 4: 26/11/2019
On mac, running this in terminal allows local bypassing of CORS:
open -na Google\ Chrome --args --user-data-dir= --disable-web-security --disable-site-isolation-trials
Also, the headers for Ionic 4 need to be this:
let headers = {
"Content-Type": "application/json"
};
// ...
this._http.post(this.apiUrl, params, { headers: headers }).toPromise().then(httpResponse => {
// ...
});
Comments: