HI, I normally add this on the app/filter.php file
App::before(function($request)
{
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With');
header('Access-Control-Allow-Credentials: true');
});
Just dropping by to say thanks, also. I tried adding the headers via a 'cors' filter and applying the 'cors' filter both before and after route. It did not work. But this suggestion did.
Hi, Create a Cors middleware and register it in the application's global HTTP middleware stack in kernel.php. Follow this for more.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community