Angular HttpClient missing response headers Angular HttpClient missing response headers angular angular

Angular HttpClient missing response headers


CORS requests only expose 6 safelisted headers : Cache-Control Content-LanguageContent-Type Expires Last-Modified & Pragma.

In order to access custom headers with a CORS request, the server has to explicitly whitelist them. This can be done by sending the response header: Access-Control-Expose-Headers

For example: Access-Control-Expose-Headers: X-Total-Count, X-Paging-PageSize

MDN Source


The headers in an HttpResponse object are lazy-loaded, so headers will appear to be empty until you force the values to be loaded. Try calling response.headers.keys() to see all available header names. By the way, this also forces all values to be loaded into the map response.headers.headers.


Try to add withCredentials: true to the http options object.