前言
报错信息:
Access to XMLHttpRequest at 'http://localhost:20001/toLogin' from origin 'http://localhost:8081' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
前端请求成功,后端返回200,然后前端到返回拦截器response前,报错了。
解决办法
参考文档1:https://segmentfault.com/q/1010000015817945
参考文档2:https://blog.csdn.net/qq_32625839/article/details/81001125
在过滤器里面加了response配置,且添加了cors跨域配置。但是依然报错。
解决方法:
https://www.jianshu.com/p/27a1072d831c
成功