This repository contains a clean and simple example of how to configure CORS (Cross-Origin Resource Sharing) in Laravel 12.
If you're working with APIs for React, Vue, Angular, Mobile Apps, or any frontend on a different domain, proper CORS setup is essential — and this guide shows you exactly how to do it.
📖 Full Blog Tutorial:
https://itstuffsolutiotions.io/laravel-12-cors-middleware-configuration-example/
- Configure CORS in Laravel 12 using built-in middleware
- Customize
config/cors.php - Support for multiple origins, headers, and methods
- Apply CORS globally or only to specific routes
- Works for SPA, mobile apps, and microservices
- Laravel 12
- PHP 8.2 or higher
- Basic understanding of routes & middleware
Laravel 12 includes the CORS configuration file by default.
If needed, publish it using:
php artisan vendor:publish --tag=laravel-cors