Support the ongoing development of Laravel.io →
Configuration Laravel Requests

Hello,

I made the huge mistake of ugprading my app to laravel 7 and since then I haven't be able to make it work again.

The problem I've is with the cors, I get this error :
Access to XMLHttpRequest has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. when I try to create a new report.

I've a pwa app where you can register, login, update your informations, create new report, list all reports.

Everything work but creating new report. When I update my personnal information I don't get any CORS error but when i try to create a new report I've this error everytime.

What's weird is that if I sent the form and it doesn't pass the validation everything work as expected (I get errors in the response) but if the form is valid then I get the cors error

My cors config file

<?php

return [
    'paths' => ['api/*'],

    'allowed_methods' => ['*'],

    'allowed_origins' => ['*'],

    'allowed_origins_patterns' => [],

    'allowed_headers' => ['*'],

    'exposed_headers' => false,

    'max_age' => false,

    'supports_credentials' => true,
];

In local everything work as expected so it doesn't come from the pwa app.

Any idea ?

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.