When I tried to send http request, I got this error about CORS.
XMLHttpRequest cannot load 'sever-domain'.
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'my-firebsase-hosted-app-domain' is therefore not allowed access.
Then I set headers to my http request like this.
let headers = new Headers(
{
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/x-www-form-urlencoded'
}
);
let options = new RequestOptions({ headers: headers });
this.postRequestSub = this._http.post(this.url, body, options);
But I still have the same error, isn't this a correct way to solve it?