Wide Angle API

2

I am trying to make a request using angular connecting to REST API built in laravel.

XMLHttpRequest cannot load http://localhost:8000/rest/v1/entidades/licitacoes. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access. The response had HTTP status code 500.

I know the API should set the header, however when testo with POSTMAN it works normally. What could be happening?

    
asked by anonymous 21.06.2016 / 20:31

1 answer

4

You need to configure the CORS headers so that the request from the browser works fine. All modern browsers make a request known as preflight before requesting or posting data itself, in order to see if it is possible to send them.

This Laravel package helps you configure CORS in your Laravel application: link

    
21.06.2016 / 20:39