Getting Date from http header response

前端 未结 4 592
既然无缘
既然无缘 2021-01-12 09:17

Okay so I can access the HTTP ajax response header using

xhr.getAllResponseHeaders();

but it doesn\'t seem to get the Date with it, though

4条回答
  •  星月不相逢
    2021-01-12 09:36

    It might be the case you are making a CORS request and the headers are filtered out for security reasons.

    See also similar question about missing response headers in ajax request. The solution might be to set this HTTP header in the server response:

    Access-Control-Expose-Headers: Date
    

提交回复
热议问题