AJAX get custom response headers with CORS

回眸只為那壹抹淺笑 提交于 2019-12-23 20:19:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!