我无法使用 CORS 和 AngularJS 进行 DELETE [英] I can't make a DELETE with CORS and AngularJS
本文介绍了我无法使用 CORS 和 AngularJS 进行 DELETE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 AngularJS 发出 DELETE 请求.
I'm trying to make a DELETE request with AngularJS.
我正在从服务器发送此标头:
I'm sending this headers from the Server:
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: origin, x-requested-with, content-type, accept');
header('Access-Control-Allow-Method: GET, POST, OPTIONS, DELETE');
但是在 Chrome 中,当我执行
But in Chrome, when I do an
$http({method: 'DELETE', url: EmployeesURL + "remove/id/" + id})
它抛出一个方法 DELETE is not allowed by Access-Control-Allow-Methods. 错误.
推荐答案
看起来您缺少一个 's' Access-Control-Allow-Methods
Looks like you are missing an 's' Access-Control-Allow-Methods
这篇关于我无法使用 CORS 和 AngularJS 进行 DELETE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文