jeudi 26 novembre 2015

Laravel header CORS

Problem

When I go to the url http://api.example.com through my browser (Chrome), it shows me this, with correct headers (notice the Access-Control-Allow-Origin field)

enter image description here

But when I do a post request to http://api.example.com from http://test.example.com, it shows me this enter image description here

And the console shows me

XMLHttpRequest cannot load http://ift.tt/1T8hGTP. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://test.example.dev' is therefore not allowed access. The response had HTTP status code 500.

What I did

I'm using the framework Laravel 5 and I followed this tutorial to add header to responses. I copied exactly the piece of code of the tutorial. What is still wrong here ?

Here is my routes file :

enter image description here

And my Cors Middleware file : enter image description here



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

Aucun commentaire:

Enregistrer un commentaire