Amitava
Amitava

Reputation: 5083

AJAX get custom response headers with CORS

My server sends custom headers along with the response. I get the response data alright, but I can't access the custom headers with jQuery's getAllResponseHeaders() or AngularJS $http service. All I get is content-type. When I inspect the request response with DevTools or fiddler, I can see all the custom headers being sent by the server, but I can't get them from xhr. Is there any way to access all the headers?

Upvotes: 3

Views: 1651

Answers (1)

Amitava
Amitava

Reputation: 5083

OK I got this working after adding allowed headers in my server config Access-Control-Expose-Headers

Upvotes: 7

Related Questions