IIS8.0中部署vue3(axios) + django 项目后,在前端发起DELETE或者PUT请求时出现错误:
Access to XMLHttpRequest at 'http://****:8427/proj_file/4/' from origin 'http://****:8426' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
xhr.js:210 DELETE http://*****/proj_file/4/ net::ERR_FAILED 405
一开始以为是跨域请求问题,但是后端django后端已配置好跨域设置,以前前端的GET、POST请求并没有问题,所以后来才发现原来是IIS的问题!!
IIS 8.0中将集成了WebDAV模块,该模块禁止了PUT和DELETE防范,禁用WebDAV模块都没有用,必须移除此模块,方法如下:
在对应网站的模块下,删除WebDAVModule,重启即可。
网友评论