后台解决跨域问题

论坛 期权论坛 脚本     
已经匿名di用户   2022-7-2 22:14   1931   0
 //允许所有地址

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

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:81
帖子:4969
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP