mardi 15 novembre 2016

Ionic Laravel Cors Issue

I am doing a Ionic App and using a Laravel 5.2 project as backend.

I already prepared a api.domain endpoint, but when I try to do any request from the ionic app to the Laravel project, my OPTIONS request gets rejected and the POST fails.

At the moment, my setup on the Laravel project is: Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET, POST, OPTIONS Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With

The request from ionic sends this: Access-Control-Request-Headers: content-type Access-Control-Request-Method: POST

As you can see, the POST and also the OPTIONS methods are allowed for all origins.

I already tried to change Allow-origin from * to http://localhost:8100 because that's the origin that appears on the request headers since it's a project running on localhost.

I'm a little lost since the requested method and headers exists on server's response.

Does someone know what I'm missing here?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2gcJ2iw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire