您的位置:首页 > 移动开发 > 微信开发

canvas跨域完美解决,微信头像解决跨域

2018-01-25 17:49 344 查看
最新的需求中需要把微信头像作为截图的一部分,但是涉及到跨域

解决方案:

location ^~ /wechat_image/ {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified- Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
proxy_pass http://wx.qlogo.cn/; }
然后将微信的头像 http://wx.qlogo.cn/xxx => http://${自己的域名}/wechat_image/xxx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: