文章目录
通过Nginx代理机制下载微信二维码
通过nginx代理机制,解决 前端 在页面中通过js直接下载微信二维码产生的跨域问题。
location ^~ /cgi-bin/ {
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 https://mp.weixin.qq.com/;
}