一般情況下,我們跨域請求或者跨域上傳,都需要修改nginx的配置文件
比如設計跨域上傳:
WechatIMG398.jpeg
如果你的反向代理是Nginx的話 跨域修改nginx下的vhost文件夾下you_conf
cd /you_name_nginx_dir/conf/vhost/
vim you_name.conf
location / {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'OPTION, POST, GET';
add_header 'Access-Control-Allow-Headers' 'X-Requested-With, Content-Type';
try_files $uri $uri/ /index.php?$query_string; //針對lumen與Laravel框架
}