mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 14:53:45 +02:00
Fix a fallback route issue causing API calls to return unauth responses and not 404s
The fallback handler isn't scoped to a specific group, so the way this was setup caused requests to non-existent API routes to actually try and return the base view for Vue. This caused a mess of issues because that view is behind the middleware that expect sessions to be set, thus leading to very confusing authentication errors rather than a 404 response.
This commit is contained in:
@@ -1,17 +1,8 @@
|
||||
<?php
|
||||
|
||||
Route::get('/', 'IndexController@index')->name('index');
|
||||
Route::get('/', 'IndexController@index')->name('index')->fallback();
|
||||
Route::get('/account', 'IndexController@index')->name('account');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Account Controller Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Endpoint: /account
|
||||
|
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Account API Controller Routes
|
||||
@@ -23,9 +14,7 @@ Route::get('/account', 'IndexController@index')->name('account');
|
||||
Route::group(['prefix' => 'account/api'], function () {
|
||||
Route::get('/', 'ClientApiController@index')->name('account.api');
|
||||
Route::get('/new', 'ClientApiController@create')->name('account.api.new');
|
||||
|
||||
Route::post('/new', 'ClientApiController@store');
|
||||
|
||||
Route::delete('/revoke/{identifier}', 'ClientApiController@delete')->name('account.api.revoke');
|
||||
});
|
||||
|
||||
@@ -43,5 +32,5 @@ Route::group(['prefix' => 'account/two_factor'], function () {
|
||||
Route::post('/totp/disable', 'SecurityController@delete')->name('account.two_factor.disable');
|
||||
});
|
||||
|
||||
// Catch any other combinations of routes and pass them off to the Vuejs component.
|
||||
Route::fallback('IndexController@index');
|
||||
Route::get('/{vue}', 'IndexController@index')
|
||||
->where('vue', '^(?!(\/)?(api|admin|daemon)).+');
|
||||
|
||||
Reference in New Issue
Block a user