I am using XAMPP for running the laravel APIs.
I want my react application to call those APIs.
I am getting an issue of cors error “Access to XMLHttpRequest at ‘http://127.0.0.1:8000/api/search_design’ from origin ‘http://localhost:5173’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”.
I have added a middleware in laravel which will add the cors header in my request and then pass on to the api end point.
Gaurav Hiran is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.