question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Hola

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:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

19reactions
DaruoMatrixcommented, Jul 14, 2018

download the extension “Allow-Control-Allow-Origin” if you use chrome

5reactions
suhailkccommented, Sep 3, 2018

chrome extension “Allow-Control-Allow-Origin:*” solved my problem

thanks @DaruoMatrix

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found