且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

访问angularjs中的自定义http响应标头

更新时间:2022-04-02 05:45:21

我认为你走在正确的轨道上。要访问自定义标头,您的服务器需要设置此特殊的 Access-Control-Expose-Headers 标头,否则您的浏览器将只允许访问列出的6个预定义标头值在 Mozilla docs 中。

I think you are on the right track. To have access to custom headers, your server needs to set this special Access-Control-Expose-Headers header, otherwise your browser will only allow access to 6 predefined header values as listed in the Mozilla docs.

在屏幕截图中,响应中不存在此标题。你应该看看这个cors标题的后端也会出现在响应中。

In your screenshot such a header is not present in the response. You should have a look at the backend for this cors header to also be present in the response.