{"action":"created","issue":{"url":"https://api.github.com/repos/barryvdh/laravel-cors/issues/127","repository_url":"https://api.github.com/repos/barryvdh/laravel-cors","labels_url":"https://api.github.com/repos/barryvdh/laravel-cors/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/barryvdh/laravel-cors/issues/127/comments","events_url":"https://api.github.com/repos/barryvdh/laravel-cors/issues/127/events","html_url":"https://github.com/barryvdh/laravel-cors/issues/127","id":169205047,"number":127,"title":"Error (No 'Access-Control-Allow-Origin' header is present on the requested resource.)","user":{"login":"vitalibr","id":6042958,"avatar_url":"https://avatars.githubusercontent.com/u/6042958?v=3","gravatar_id":"","url":"https://api.github.com/users/vitalibr","html_url":"https://github.com/vitalibr","followers_url":"https://api.github.com/users/vitalibr/followers","following_url":"https://api.github.com/users/vitalibr/following{/other_user}","gists_url":"https://api.github.com/users/vitalibr/gists{/gist_id}","starred_url":"https://api.github.com/users/vitalibr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitalibr/subscriptions","organizations_url":"https://api.github.com/users/vitalibr/orgs","repos_url":"https://api.github.com/users/vitalibr/repos","events_url":"https://api.github.com/users/vitalibr/events{/privacy}","received_events_url":"https://api.github.com/users/vitalibr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2016-08-03T18:49:12Z","updated_at":"2016-09-09T12:09:05Z","closed_at":null,"body":"Hi all and @barryvdh,\r\n\r\nI created an application in AngularJS and I'm trying to make calls to the Laravel API: \r\n\r\n* MyApp (AngularJS): **http://localhost:8080/**\r\n* API (Laravel Boilerplate): **http://localhost:8000/**\r\n\r\nI use Laravel [API Boilerplate (JWT Edition)][1] to API.\r\n\r\nBut I get this error in the browser console:\r\n\r\n> XMLHttpRequest cannot load http://localhost:8000/api/auth/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.\r\n\r\nI tried to apply the cors middleware (barryvdh/laravel-cors) in api_routes.php but the error remains.\r\n\r\napi_routes.php:\r\n\r\n\r\n    <?php\r\n        \r\n    $api = app('Dingo\\Api\\Routing\\Router');\r\n    \r\n    $api->version('v1', ['middleware' => 'cors'], function ($api) {\r\n    \r\n        $api->post('auth/login', 'App\\Api\\V1\\Controllers\\AuthController@login');\r\n        $api->post('auth/signup', 'App\\Api\\V1\\Controllers\\AuthController@signup');\r\n        $api->post('auth/recovery', 'App\\Api\\V1\\Controllers\\AuthController@recovery');\r\n        $api->post('auth/reset', 'App\\Api\\V1\\Controllers\\AuthController@reset');\r\n    \r\n        // example of protected route\r\n        $api->get('protected', ['middleware' => ['api.auth'], function () {     \r\n            return \\App\\User::all();\r\n        }]);\r\n    \r\n        // example of free route\r\n        $api->get('free', function() {\r\n            return \\App\\User::all();\r\n        });\r\n    \r\n    });\r\n\r\nMy config/cors.php:\r\n```\r\nreturn [\r\n    'supportsCredentials' => false,\r\n    'allowedOrigins' => ['*'],\r\n    'allowedHeaders' => ['*'],\r\n    'allowedMethods' => ['*'],\r\n    'exposedHeaders' => [],\r\n    'maxAge' => 0,\r\n    'hosts' => [],\r\n];\r\n```\r\n\r\nError:\r\n![Error](https://s31.postimg.org/synyo4vrf/error.png)\r\n![Error](https://s31.postimg.org/4w74t9f4b/error2.jpg)\r\n\r\n\r\n\r\n  [1]: https://github.com/francescomalatesta/laravel-api-boilerplate-jwt"},"comment":{"url":"https://api.github.com/repos/barryvdh/laravel-cors/issues/comments/245895247","html_url":"https://github.com/barryvdh/laravel-cors/issues/127#issuecomment-245895247","issue_url":"https://api.github.com/repos/barryvdh/laravel-cors/issues/127","id":245895247,"user":{"login":"sandervanhooft","id":7265703,"avatar_url":"https://avatars.githubusercontent.com/u/7265703?v=3","gravatar_id":"","url":"https://api.github.com/users/sandervanhooft","html_url":"https://github.com/sandervanhooft","followers_url":"https://api.github.com/users/sandervanhooft/followers","following_url":"https://api.github.com/users/sandervanhooft/following{/other_user}","gists_url":"https://api.github.com/users/sandervanhooft/gists{/gist_id}","starred_url":"https://api.github.com/users/sandervanhooft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandervanhooft/subscriptions","organizations_url":"https://api.github.com/users/sandervanhooft/orgs","repos_url":"https://api.github.com/users/sandervanhooft/repos","events_url":"https://api.github.com/users/sandervanhooft/events{/privacy}","received_events_url":"https://api.github.com/users/sandervanhooft/received_events","type":"User","site_admin":false},"created_at":"2016-09-09T12:09:05Z","updated_at":"2016-09-09T12:09:05Z","body":"@goeroeku Did you set it to `-1`? I am going to try this."}}
{"actor":{"display_login":"sandervanhooft"}}