Failed to load http://localhost:8000/api/details: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.
See original GitHub issueHola
Mi servidor (Web Service Rest) esta en Laravel (ultima version) Mi app cliente este en Ionic 3 (Ultima version)
Tengo este problema:
Failed to load http://localhost:8000/api/details: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:8100’ is therefore not allowed access.
Y la cuestion es que las rutas normales funcionan bien, el cors la acepta.
Pero las rutas del Auth Passport de laravel no funcionan
Este es el archivo de Cors.php
public function handle($request, Closure $next)
{
$response = $next($request)
->header('Access-Control-Allow-Origin', '*')
->header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE')
->header('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
return $response;
}
Este es el archivo de api.php
Route::group(['middleware' => 'cors'], function () {
Route::group(['middleware' => 'auth:api'], function() {
Route::post('details', 'PassportAuthController@details');
});
});
Ayuda, gracias.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
No 'Access-Control-Allow-Origin' header is present on the ...
I keep getting this error message: Fetch API cannot load . Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' ...
Read more >Fixing "No 'Access-Control-Allow-Origin' Header Present"
This error occurs when a script on your website/web app attempts to make a request to a resource that isn't configured to accept...
Read more >Fixing Common Problems with CORS and JavaScript
Tutorial: This post walks through troubleshooting and fixing common problems associated with calling REST APIs from JavaScript.
Read more >Reason: CORS header 'Access-Control-Allow-Origin' missing
The response to the CORS request is missing the required Access-Control-Allow-Origin header, which is used to determine whether or not the ...
Read more >Issues - GitHub
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
download the extension “Allow-Control-Allow-Origin” if you use chrome
chrome extension “Allow-Control-Allow-Origin:*” solved my problem
thanks @DaruoMatrix