laravels 接口跨域 has been blocked by CORS policy No Access-Control-Allow-Origin header is present o

laravel-s接口跨域

has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested

nginx配置里面添加头

location @laravels {
        ........................................................
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Credentials: true;
	    ........................................................
}

原因分析

一般在index.php设置头就可以了,但laravel-s在nginx里面又转发了一次。头没带过来

参考

你可能感兴趣的:(laravel)