TP接口 前端vue调用出现跨域
出现跨域的解决方式
1.当预处理请求options失败, 代码报错 会出现跨域cors,排查错误代码
2.设置路由跨域 Route::GET('search/list', 'Index/list')->allowCrossDomain();
3.在nginx中
location / {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' '*';
add_header 'Access-Control-Allow-Headers' '*';
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}

浙公网安备 33010602011771号