I am getting Access-Control-Allow-Origin error.
Access to XMLHttpRequest at 'https://localhost:44301/api/XXXX/GetAllXXXX' from origin 'https://localhost:44322' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
And below is my header which i have passing to api call.
getAllItems<T>(): Observable<T> {
const options = { headers: this.getRequestHeaders() };
return this.http.get<T>(this.getAllItemUrl, options);
}
protected getRequestHeaders(): HttpHeaders {
let headers = new HttpHeaders({
'Content-Type': 'application/json',
'Accept': `application/json, text/plain, */*`,
'App-Version': '1',
});
return headers;
}
Am i missing anything to connect my API's here?