I'm struggling with this problem for over 5 hours. so please help :)
My front-end stack is Angularjs
& My back-end stack is LAMP
with Laravel
framework.
The problem I have is that when I want to send a GET
request with $http
service in a ui-router
resolver as a dependency, firefox throws error : The Same Origin Policy disallows reading the remote resource
but I have configured my backend with barryvdh/laravel-cors
package in order to use its middleware to set proper headers.
Angular code snippet :
$http.post('http://example.com', data)
.then(function (data, status, headers, config) {
},
function (data, status, headers, config) {
});
Laravel code snippet :
//controller constructor
public function __construct()
{
//parent::__construct();
$this->middleware('cors');
}
Its a really simple and normal code, I don't know why it doesn't work.
This is my log of HTTP request/response :
I don't know why the CORS headers are not present although they are present in server log.