Request has been blocked by CORS policy


I have a problem with an API. I make a call and get the following error message:

Access to XMLHttpRequest at '' from origin 'http://localhost:8080' 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.

The same call from postman works fine.

In the API (php with laravel) they show me that everything is correct:

            ->header('Access-Control-Allow-Origin', '*')
            ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS, PATCH')
            ->header('Access-Control-Allow-Headers', '*')

What can be my problem and how can I solve it? My project is made with F7 + vue.js

Your problem should be very clear and simple in solution. But this is a server-side problem. Try making a get request from a different port like localhost: 5000 to understand the problem. If successful, Laravel may be asking for a special API or app key (token).

Something similar has happened to me before. If I didn’t give the required token to the API, I would get a cross error.

I looked through all the parameters and found what I needed.