Reputation: 21
laravel route file
var apiUrl = "http://myipaddress/api";
after that i am calling login api that its called localhost path :
http://localhost:8000/api
and it gives CORS error as below:
Failed to load http://localhost:8000/api/auth/login: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://myipaddress' is therefore not allowed access.
Is there any solutions for this?
Thanks in advance..
Upvotes: 1
Views: 101
Reputation: 1
I advise you to read up on CORS generally: https://developer.mozilla.org/de/docs/Web/HTTP/CORS
To solve your issue, you'd need to configure your webserver to allow that origin, by e.g. using this middleware: https://github.com/barryvdh/laravel-cors
See the Configuration part of the docs concerning allowedOrigins
.
Kind regards
Upvotes: 0