@dgloria Have you cleared your config cache?
php artisan config:cache
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi all, I have read everything in this topic and tried to change my settings in a million ways, still stuck. I have a frontend on https://dbgtr.netlify.app/ an on http://localhost:5173/ (both have issues), and I am targeting the api endpoint on https://budgeterapi.dgloriaapi.co.uk/api/login This results in an error, in devtools I see result: CORS error. I've got another endpoint on the root domain https://dgloriaapi.co.uk/api/login, if I hit that, it works without problem. I also use postman to hit the above subdomain and it has no errors, I can login. What I've tried: in the config/cors.php I've changed the 'allowed_origins' => ['*'] to the above two links explicitly, but nothing changed. I use Laravel8 with Passport.
The error that shows in the browser is: "Access to XMLHttpRequest at 'https://budgeterapi.dgloriaapi.co.uk/api/login' from origin 'https://dbgtr.netlify.app' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource."
What I have tried:
'allowed_origins' => ['dbgtr.netlify.app/*','dbgtr.netlify.app','localhost:5173','localhost:5173/*'],
then php artisan config:cache
also tried
'allowed_origins' => ['https://dbgtr.netlify.app/*','https://dbgtr.netlify.app','http://localhost:5173','http://localhost:5173/*'],
My config/cors.php looks like this:
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
// 'allowed_origins' => ['dbgtr.netlify.app/*','dbgtr.netlify.app','localhost:5173','localhost:5173/*'],
'allowed_origins' => ['https://dbgtr.netlify.app/*','https://dbgtr.netlify.app','http://localhost:5173','http://localhost:5173/*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
Please help. Thank you
Please or to participate in this conversation.