Send CORS headers in a Laravel application
The Spatie Laravel CORS package is designed to add Cross-Origin Resource Sharing (CORS) headers to responses in your Laravel or Lumen application. The package offers support for preflight requests and allows for easy configuration to suit your specific needs.
Install the package via Composer:
composer require spatie/laravel-cors
The package will auto-register its service provider. Register the provided Spatie\Cors\Cors
middleware in the global middleware group. The default configuration file will be available at config/cors.php
.
Install the package via Composer: