我正在尝试使用发布请求将文件发送到我的服务器,但是当它发送它时会导致错误:
Request header field Content-Type is not allowed by Access-Control-Allow-Headers.
所以我用 Google 搜索了错误并添加了 Headers :
$http.post($rootScope.URL, {params: arguments}, {headers: {
"Access-Control-Allow-Origin" : "*",
"Access-Control-Allow-Methods" : "GET,POST,PUT,DELETE,OPTIONS",
"Access-Control-Allow-Headers": "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"
}
然后我得到错误:
Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers
所以我用谷歌搜索了那个,我能找到的唯一类似的问题提供了一个半答案然后关闭作为主题 . 我应该添加 / 删除哪些 Headers ?