已阻止跨源请求 Laravel

Cross-Origin Request Blocked Laravel

我有 Laravel 5.5 应用程序,我想避免 Cross-Origin Request Blocked 错误。我试图安装 barryvdh/laravel-cors 包,但它与 Laravel 5.5

不兼容
barryvdh/laravel-cors v2.0.0 requires illuminate/contracts ^5.6|^6.0|^7.0|^8.0 -> satisfiable by illuminate/contracts[5.7.17, 5.7.18, 5.7.19, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37...etc

我可以使用其他解决方案吗?也许是本机解决方案或为 Laravel 5.5?

编写我自己的中间件

安装v1.0.6,兼容Laravel 5.5

https://packagist.org/packages/barryvdh/laravel-cors#v1.0.6