hasbeenblockedbyCORSpolic

Error:

创新互联专注于永康网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供永康营销型网站建设,永康网站制作、永康网页设计、永康网站官网定制、成都小程序开发服务,打造永康网络公司原创品牌,更为您提供永康网站排名全网营销落地服务。

前端访问后端时出现如下报错:

Access to XMLHttpRequest at 'http://localhost:8000/api/slideshow' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

解决

安装 CORS Middleware for Laravel. (fruitcake /laravel-cors)

The laravel-cors package allows you to send Cross-Origin Resource Sharing headers with Laravel middleware configuration.

https://github.com/fruitcake/laravel-cors


分享文章:hasbeenblockedbyCORSpolic
文章出自:http://hbruida.cn/article/psieio.html