Pedro Pool Pedro Pool - 3 years ago 86
AngularJS Question

Angular http GET 405 (Method Not Allowed)

I'm implementing another function in an application (made with angular), I call an API (made with Lumen) and it returns a 405 error whem i tried in local and "XMLHttpRequest cannot load Response for preflight is invalid (redirect)" when i tried on the server. I read about CORS but it's already implemented, I think if it isn't none of others functions would work.

Another thing, if I make the call with Advanced Rest Client it works fine :(

sorry about my english, i don't speak it so much.

function on application

$scope.agencias = [];

method: 'GET',
//url: '',
url: 'http://localhost:8000/agencias/',
headers: agenciaMazda.headers
}).then(function successCallback(response) {
$scope.agencias =;
console.log("regreso del http");
}, function errorCallback(response) {

route on web.php


controller in CitasController.php

public function agenciasDisponibles(Agencia $agencia){
$fabricante = $this->request->header('Aldorf-App');
$disponibles = Agencia::where('fabricante', $fabricante)->where('mostrar', 1)->select(['codigo', 'nombre'])->get();
return $disponibles;

Answer Source

Finally i solved it, it was really dumb, i added a slash at the end of the uri xD it had to be "http://localhost:8000/agencias" instead of "http://localhost:8000/agencias/"

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download