In my angular app, I need to retrieve Location data from the response header. The server (Nginx) is configured to allow cross origin and to allow/expose location in header. I can see this in the chrome DEV console but in my angular app, I don't see any data for the header.
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers:Location, Content-Type
Access-Control-Expose-Headers:Location, Content-Type
Here is my code snippet.
this.httpClient.post( url, {
UserName: username,
Password: password
}
)
.subscribe(
(res: Response) => {
console.log(res.headers);
},
error => {console.log('Error occured::' + error);
}
);
console.log(res.headers) returns undefined.
What's going wrong here?