版权声明:本文为博主原创文章,未经博主允许可以转载。 https://blog.csdn.net/qq_36949713/article/details/82503809
//允许所有地址
response.setHeader("Access-Control-Allow-Origin", "*");
//允许的方法
response.setHeader("Access-Control-Allow-Methods", "POST, GET,PUT, OPTIONS, DELETE,OPTIONS");
//所能看到的请求头
response.setHeader("Access-Control-Allow-Headers","Authorization,Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With");
//浏览器所能获取到的请求头
response.setHeader("Access-Control-Expose-Headers","Authorization,Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With");