node跨域访问数据
2019-05-17 本文已影响0人
萤火虫de梦
node返回数据时,设置下面头部跨域实现跨域
res.setHeader('Access-Control-Allow-Origin','*');
res.setHeader('Access-Control-Allow-Headers',
'Content-Type, Content-Length, Authorization,
Accept, X-Requested-With , yourHeaderFeild');
res.setHeader('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');