问题
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?
回答1:
OK I got this working after adding allowed headers in my server config Access-Control-Expose-Headers
来源:https://stackoverflow.com/questions/18414698/ajax-get-custom-response-headers-with-cors