Search code examples
angularspring-boothttpclientcustom-headers

In Angular4 HttpClient.get , none of the custom headers returned back


My backend is spring boot 1.5.7 and the front end is angular4.4.3,

the response dont include all headers actually it includes only cache-control,content-type ,pragma and expires while the custom headers not there and the same time postman show that all others are returned

constructor(private http2: HttpClient) { }   
listAll{ this.http2.get<ItemsResponse>('http://mysite:8080' , {observe: 'response'}).subscribe(resp => {
console.log(resp.headers.get('xyz'));
console.log(resp.body.response);
}
);

Solution

  • did you allow/expose those headers with CORS on server?