{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/14858","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/14858/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/14858/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/14858/events","html_url":"https://github.com/laravel/framework/issues/14858","id":171602104,"number":14858,"title":"For OPTIONS request Route::any() not work like Route::match(['OPTIONS'],...)","user":{"login":"Denys-Bushulyak","id":6935209,"avatar_url":"https://avatars.githubusercontent.com/u/6935209?v=3","gravatar_id":"","url":"https://api.github.com/users/Denys-Bushulyak","html_url":"https://github.com/Denys-Bushulyak","followers_url":"https://api.github.com/users/Denys-Bushulyak/followers","following_url":"https://api.github.com/users/Denys-Bushulyak/following{/other_user}","gists_url":"https://api.github.com/users/Denys-Bushulyak/gists{/gist_id}","starred_url":"https://api.github.com/users/Denys-Bushulyak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Denys-Bushulyak/subscriptions","organizations_url":"https://api.github.com/users/Denys-Bushulyak/orgs","repos_url":"https://api.github.com/users/Denys-Bushulyak/repos","events_url":"https://api.github.com/users/Denys-Bushulyak/events{/privacy}","received_events_url":"https://api.github.com/users/Denys-Bushulyak/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-17T08:29:30Z","updated_at":"2016-09-12T14:09:58Z","closed_at":null,"body":"Found this issue when trying implement CORS response to AJAX fetch.\r\n\r\nRoute::any() does not handle OPTIONS request as expected, but Route::match(['OPTIONS']) was."},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/246358934","html_url":"https://github.com/laravel/framework/issues/14858#issuecomment-246358934","issue_url":"https://api.github.com/repos/laravel/framework/issues/14858","id":246358934,"user":{"login":"barryvdh","id":973269,"avatar_url":"https://avatars.githubusercontent.com/u/973269?v=3","gravatar_id":"","url":"https://api.github.com/users/barryvdh","html_url":"https://github.com/barryvdh","followers_url":"https://api.github.com/users/barryvdh/followers","following_url":"https://api.github.com/users/barryvdh/following{/other_user}","gists_url":"https://api.github.com/users/barryvdh/gists{/gist_id}","starred_url":"https://api.github.com/users/barryvdh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barryvdh/subscriptions","organizations_url":"https://api.github.com/users/barryvdh/orgs","repos_url":"https://api.github.com/users/barryvdh/repos","events_url":"https://api.github.com/users/barryvdh/events{/privacy}","received_events_url":"https://api.github.com/users/barryvdh/received_events","type":"User","site_admin":false},"created_at":"2016-09-12T14:09:58Z","updated_at":"2016-09-12T14:09:58Z","body":"Yes, `any()` doesn't register the Options route: https://github.com/laravel/framework/blob/c7de016c568c0b1555914487b0944b7298105fbe/src/Illuminate/Routing/Router.php#L208-L213\r\n\r\n```php\r\npublic function any($uri, $action = null)\r\n    {\r\n        $verbs = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE'];\r\n        return $this->addRoute($verbs, $uri, $action);\r\n    }\r\n```\r\n\r\nIn my cors package, I intercept the CORS request in my ServiceProvider:\r\nhttps://github.com/barryvdh/laravel-cors/blob/7236b8ca722fb404c5f83444eca195ec4ca46d55/src/ServiceProvider.php#L42-L44\r\nAnd use the Router to detect if it can match the Router for the requested verb (so not OPTIONS, but e.g POST). If so, return a response from the middleware directly:\r\nhttps://github.com/barryvdh/laravel-cors/blob/master/src/HandlePreflight.php"}}
{"actor":{"display_login":"barryvdh"}}