I have a web app where I need to make a request to a webservice outside of my page.
This request is made from within a restricted page, and because of this, I have a x-xsrf-token
set, to autenticate my user on my webpage. This is working.
But I also need to make a request to a webservice outside of my page, but it does not accept x-xsrf-token
, given me this error:
XMLHttpRequest cannot load "https://webservice-here..." Request header field X-XSRF-TOKEN is not allowed by Access-Control-Allow-Headers in preflight response.
But since I'm inside a restricted area, I don't know how to solve this issue... This is my http
service:
apiCustom(url: string) {
let headers = new Headers();
headers.delete('x-xsrf-token');
return this._http.get(url, {
headers: headers
}).map(response => response.json()).do(data => {
return data;
}).catch(this.handleErrors);
}
I tried to delete the x-xsrf-token
(also tried just xsrf-token
) manually, but it didn't worked.
Is there a way to solve this?