Angular http GET 405(不允许的方法)

Angular http GET 405 (Method Not Allowed)

我正在一个应用程序中实现另一个功能(用 angular 制作),我调用了一个 API(用 Lumen 制作)并且它 returns 在我尝试时出现 405 错误在本地和 "XMLHttpRequest cannot load Response for preflight is invalid (redirect)" 当我在服务器上尝试时。我阅读了有关 CORS 的内容,但它已经实现了,我认为如果它不是 none,其他功能也可以使用。

另一件事,如果我使用 Advanced Rest Client 进行调用,它工作正常:(

对不起我的英语,我不太会说。

应用程序的功能

$scope.agencias = [];

$http({
    method: 'GET',
    //url: 'http://api-beta.grupoaldorf.com.mx/agencias/',
    url: 'http://localhost:8000/agencias/',
    headers: agenciaMazda.headers
}).then(function successCallback(response) {
    $scope.agencias = response.data;
    console.log("regreso del http");
    console.log($scope.agencias);
}, function errorCallback(response) {
    //callback(false);
});

路线 web.php

$app->get('agencias','CitasController@agenciasDisponibles');

控制器在 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;
}

最后我解决了它,它真的很愚蠢,我在 uri 的末尾添加了一个斜杠 xD 它必须是“http://localhost:8000/agencias" instead of "http://localhost:8000/agencias/