本文介绍了CORS / xhr.getRequestHeaders的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我试图使用CORS(),当我尝试从XMLHTTPRequest读取响应头,我只收到内容类型。没有其他很标准的标头通过,我不知道如何让这个工作。

I am trying to use CORS (http://www.w3.org/TR/2009/WD-cors-20090317/#access-control-allow-methods-header) for an application on Safari, and when I try to read the response headers from the XMLHTTPRequest, I only receive the Content-Type. None of the other quite standard headers gets through, and I cannot figure out how to get this to work.

任何人都会发生,知道如何解决这个问题?这是一个WebKit错误吗?

Anyone would happen to know how to fix this issue? Could this be a WebKit bug?

编辑

使用nGinx:

add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers Cache-Control,Pragma,Date;
add_header Access-Control-Allow-Methods GET,POST;


推荐答案

为了让标题暴露给JS,需要设置)

这篇关于CORS / xhr.getRequestHeaders的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 23:11