I can't make a DELETE with CORS and AngularJS

可紊 提交于 2020-01-06 06:41:58

问题


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');

But in Chrome, when I do an

$http({method: 'DELETE', url: EmployeesURL + "remove/id/" + id}) 

it throws a Method DELETE is not allowed by Access-Control-Allow-Methods. error.


回答1:


Looks like you are missing an 's' Access-Control-Allow-Methods



来源:https://stackoverflow.com/questions/13007187/i-cant-make-a-delete-with-cors-and-angularjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!